aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2019-09-16 23:13:26 +0200
committerThomas White <taw@bitwiz.me.uk>2019-09-16 23:13:26 +0200
commit83a9bd9c33a5eb6e54053d0ec8ab1e5b1ddd7826 (patch)
tree76a6ec2dd8c04f71a76e0e62ff7cd4a68eca3799
parentc6abe4626c40d4925d6233cf0ca1c30cd49a22cd (diff)
Parser fixes
-rw-r--r--libstorycode/storycode.l7
-rw-r--r--libstorycode/storycode.y2
2 files changed, 6 insertions, 3 deletions
diff --git a/libstorycode/storycode.l b/libstorycode/storycode.l
index b4dbb03..e0dd6f8 100644
--- a/libstorycode/storycode.l
+++ b/libstorycode/storycode.l
@@ -88,11 +88,12 @@ BGCOL { BEGIN(col); return SC_BGCOL; }
<INITIAL>:[ ] { BEGIN(runtext); return SC_TEXT_START; }
<runtext>[\\] { BEGIN(stringesc); }
-<stringesc>[.] { sclval.str = strdup(yytext); BEGIN(runtext); return SC_RUN_TEXT; }
+<stringesc>. { sclval.str = strdup(yytext); BEGIN(runtext); return SC_RUN_TEXT; }
<runtext>[\*] { return '*'; }
-<runtext>[^\*\n]* { sclval.str = strdup(yytext);
+<runtext>[/] { return '/'; }
+<runtext>[_] { return '_'; }
+<runtext>[^\\\*/_\n]* { sclval.str = strdup(yytext);
sclval.str[yyleng] = '\0';
- lineno++;
return SC_RUN_TEXT; }
<runtext>\n { BEGIN(0); lineno++; }
diff --git a/libstorycode/storycode.y b/libstorycode/storycode.y
index daf2504..19d9b1f 100644
--- a/libstorycode/storycode.y
+++ b/libstorycode/storycode.y
@@ -243,6 +243,8 @@ text_line:
text_run:
RUN_TEXT { $$.text = $1; $$.type = NARRATIVE_RUN_NORMAL; }
| '*' RUN_TEXT '*' { $$.text = $2; $$.type = NARRATIVE_RUN_BOLD; }
+| '/' RUN_TEXT '/' { $$.text = $2; $$.type = NARRATIVE_RUN_ITALIC; }
+| '_' RUN_TEXT '_' { $$.text = $2; $$.type = NARRATIVE_RUN_UNDERLINE; }
/* -------- Slide -------- */