Skip to content

Commit 06757ed

Browse files
committed
#200 - update grammar and lex regex
1 parent 8b5ebc5 commit 06757ed

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Domain/HydraScript.Domain.Constants/TokenTypes.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,19 @@ public static IEnumerable<Dto> Stream
6363
Priority: 11);
6464

6565
yield return new(
66-
Tag: "Print",
66+
Tag: "Output",
6767
Pattern: "[>]{3}",
6868
Priority: 12);
6969

70+
yield return new(
71+
Tag: "Input",
72+
Pattern: "[<]{3}",
73+
Priority: 13);
74+
7075
yield return new(
7176
Tag: "Operator",
7277
Pattern: "[+]{1,2}|[-]|[*]|[/]|[%]|([!]|[=])[=]|([<]|[>])[=]?|[!]|[|]{2}|[&]{2}|[~]|[:]{2}|[$]",
73-
Priority: 13);
78+
Priority: 14);
7479

7580
yield return new(
7681
Tag: "Comma",

src/Domain/HydraScript.Domain.FrontEnd/Parser/grammar.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Statement -> BlockStatement
1111
BreakStatement
1212
ReturnStatement
1313
OutputStatement
14+
InputStatement
1415

1516
Declaration -> LexicalDeclaration
1617
FunctionDeclaration
@@ -68,6 +69,7 @@ BreakStatement -> 'break'
6869
ReturnStatement -> 'return' Expression?
6970

7071
OutputStatement -> '>>>' Expression
72+
InputStatement -> '<<<' (Ident | EnvVar)
7173

7274
TypeDeclaration -> 'type' "Ident" = TypeValue
7375
TypeValue -> TypeValueBase TypeValueSuffix*

0 commit comments

Comments
 (0)