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 | |
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')
-rw-r--r-- | crawl-ref/source/util/levcomp.lpp | 26 | ||||
-rw-r--r-- | crawl-ref/source/util/levcomp.ypp | 27 |
2 files changed, 43 insertions, 10 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; } diff --git a/crawl-ref/source/util/levcomp.ypp b/crawl-ref/source/util/levcomp.ypp index 0da88b1ce1..10b74dcc04 100644 --- a/crawl-ref/source/util/levcomp.ypp +++ b/crawl-ref/source/util/levcomp.ypp @@ -15,6 +15,8 @@ int yylex(); extern int yylineno; +static bool start_marker_segment = false; + void yyerror(const char *e) { if (strstr(e, lc_desfile.c_str()) == e) @@ -280,19 +282,32 @@ tagstring : STRING } ; -marker : MARKER marker_specs { } +marker : MARKER + { + lc_map.main.add(yylineno, "marker("); + start_marker_segment = true; + } + marker_spec + { + lc_map.main.add(yylineno, ")"); + } ; -marker_specs : marker_spec { } - | marker_specs COMMA marker_spec { } +marker_spec : mspec_segments + +mspec_segments : /* nothing */ + | mspec_segments mspec_segment ; -marker_spec : ITEM_INFO +mspec_segment : STRING { lc_map.main.add( - yylineno, - make_stringf("marker(\"%s\")", + yylineno, + make_stringf( + "%s\"%s\"", + start_marker_segment? "" : " .. ", quote_lua_string($1).c_str())); + start_marker_segment = false; } ; |