diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-26 11:06:09 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-26 11:06:09 +0000 |
commit | f2a19d9971bb076f4a80a9e41ba601bc862d0fdf (patch) | |
tree | be553fe84132e1f25d5f33fb98f703378096b961 /crawl-ref/source/util/levcomp.lpp | |
parent | bc1a54904787e2f4779a99f2be1f72f6fd87679b (diff) | |
download | crawl-ref-f2a19d9971bb076f4a80a9e41ba601bc862d0fdf.tar.gz crawl-ref-f2a19d9971bb076f4a80a9e41ba601bc862d0fdf.zip |
Replaced timed markers with Lua markers. Breaks save compatibility.
KFEAT: feature names are now as in the dungeon_feature_type enum.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1930 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/util/levcomp.lpp')
-rw-r--r-- | crawl-ref/source/util/levcomp.lpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/crawl-ref/source/util/levcomp.lpp b/crawl-ref/source/util/levcomp.lpp index 6ec10124ad..e234f90b2d 100644 --- a/crawl-ref/source/util/levcomp.lpp +++ b/crawl-ref/source/util/levcomp.lpp @@ -39,14 +39,12 @@ static void clean() alloced = false; } -static void settext(bool trim_right = false, int strip_trailing = 0) +static char *copy_text(bool trim_right, int strip_trailing) { - clean(); char *newstring = NULL; if ((yylval.text = newstring = strdup(yytext))) { alloced = true; - char *s = NULL; if (trim_right) { @@ -62,6 +60,14 @@ static void settext(bool trim_right = false, int strip_trailing = 0) *s-- = 0; } } + return (newstring); +} + +static void settext(bool trim_right = false, int strip_trailing = 0) +{ + clean(); + char *newstring = copy_text(trim_right, strip_trailing); + yylval.text = newstring; } %} @@ -73,6 +79,7 @@ static void settext(bool trim_right = false, int strip_trailing = 0) %s MNAME %s KEYWORDS %x ITEM_LIST +%x TOEOL %option yylineno %option never-interactive @@ -152,6 +159,17 @@ NSPACE [^\ \t\r\n] <ARGUMENT>\r?\n { BEGIN(INITIAL); } +<TOEOL>.*\\[ \t]*$ { + settext(true, 1); + return STRING; + } + +<TOEOL>.+$ { + BEGIN(INITIAL); + settext(); + return STRING; + } + ^[ \t]*#.* ; ^\s*MAP[ \t]*$ { BEGIN(MAPDEF); } @@ -178,7 +196,7 @@ SUBST: { BEGIN(ITEM_LIST); return SUBST; } NSUBST: { BEGIN(ITEM_LIST); return NSUBST; } MONS: { BEGIN(MNAME); return MONS; } ITEM: { BEGIN(ITEM_LIST); return ITEM; } -MARKER: { BEGIN(ITEM_LIST); return MARKER; } +MARKER: { BEGIN(TOEOL); return MARKER; } SHUFFLE: { BEGIN(ITEM_LIST); return SHUFFLE; } KFEAT: { BEGIN(ARGUMENT); return KFEAT; } |