summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/src/tonkadur/fate/v1/parser/FateLexer.g420
-rw-r--r--src/core/src/tonkadur/fate/v1/parser/FateParser.g410
2 files changed, 28 insertions, 2 deletions
diff --git a/src/core/src/tonkadur/fate/v1/parser/FateLexer.g4 b/src/core/src/tonkadur/fate/v1/parser/FateLexer.g4
index 4b6edfc..68bf6d9 100644
--- a/src/core/src/tonkadur/fate/v1/parser/FateLexer.g4
+++ b/src/core/src/tonkadur/fate/v1/parser/FateLexer.g4
@@ -87,6 +87,7 @@ LET_KW: L_PAREN 'let' SEP+;
MINUS_KW: L_PAREN ('minus'|'-') SEP+;
MIN_KW: L_PAREN ('min'('imum'?)) SEP+;
MAP_KW: L_PAREN 'map' SEP+;
+STRING_KW: L_PAREN 'string' SEP+;
IMP_MAP_KW: L_PAREN 'map!' SEP+;
MAX_KW: L_PAREN ('max'('imum'?)) SEP+;
LAMBDA_KW: L_PAREN 'lambda' SEP+;
@@ -164,9 +165,24 @@ VISIT_KW: L_PAREN ('call'|'visit')(US(('seq'('uence'?))|('proc'('edure'?))))? SE
CONTINUE_AS_KW: L_PAREN (('continue'US('as'|'to'|'with'))|('jump'(US'to')?)|('go'US'to')|'exec')(US(('seq'('uence'?))|('proc'('edure'?))))? SEP+;
WHILE_KW: L_PAREN 'while' SEP+;
-WORD: ((~([ \t\r\n()]))|'(lp)'|'(rp)')+
+WORD: ((~([ \t\r\n()]))|'(lp)'|'(rp)'|'(sp)')+
{
- setText(getText().replaceAll("\\(lp\\)", "(").replaceAll("\\(rp\\)", ")"));
+ setText
+ (
+ getText().replaceAll
+ (
+ "\\(sp\\)",
+ " "
+ ).replaceAll
+ (
+ "\\(lp\\)",
+ "("
+ ).replaceAll
+ (
+ "\\(rp\\)",
+ ")"
+ )
+ );
};
COMMENT: WS* ';' .*? '\n' -> channel(HIDDEN);
diff --git a/src/core/src/tonkadur/fate/v1/parser/FateParser.g4 b/src/core/src/tonkadur/fate/v1/parser/FateParser.g4
index 8465af6..dc01452 100644
--- a/src/core/src/tonkadur/fate/v1/parser/FateParser.g4
+++ b/src/core/src/tonkadur/fate/v1/parser/FateParser.g4
@@ -2726,7 +2726,12 @@ returns [Computation result]
final StringBuilder string_builder = new StringBuilder();
}
:
+ STRING_KW sentence WS* R_PAREN
+ {
+ $result = ($sentence.result);
+ }
+ |
first_word=WORD
{
string_builder.append(($first_word.text));
@@ -3672,6 +3677,11 @@ returns [Computation result]
/* TODO: temporarily disable an compiler error category */
}
+ | STRING_KW sentence WS* R_PAREN
+ {
+ $result = ($sentence.result);
+ }
+
| L_PAREN WS+ sentence WS* R_PAREN
{
$result = ($sentence.result);