Merge pull request 'feat: Add double-quoted string constants with escapes' (#22) from string_escape into main
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Resolves #20. Reviewed-on: #22
This commit is contained in:
commit
5ef816610b
@ -39,6 +39,7 @@ context-free syntax
|
||||
|
||||
Ex.Int = INT
|
||||
Ex.LitString = STRING_LITERAL
|
||||
Ex.EscString = STRING
|
||||
Ex.Stream = <stream>
|
||||
Ex.Sum = <<Ex> + <Ex>> {left}
|
||||
Ex.Gets = [[Ex] << [Ex]] {left}
|
||||
|
1
tests/hw2.fos
Normal file
1
tests/hw2.fos
Normal file
@ -0,0 +1 @@
|
||||
<<< "Hello,\t\tworld!\n\n"
|
@ -39,6 +39,7 @@ rules
|
||||
hs: (_, Stream()) -> "StdIO"
|
||||
hs: (_, Int(x)) -> x
|
||||
hs: (_, LitString(x)) -> <haskLitString>x
|
||||
hs: (_, EscString(x)) -> x
|
||||
hs: (_, Sum(x, y)) -> $[([x] + [y])]
|
||||
|
||||
hs: (Gets(_, xn), Gets(s, x)) -> v
|
||||
|
@ -17,6 +17,7 @@ rules
|
||||
js: Stream() -> $[Stdio]
|
||||
js: Int(x) -> x
|
||||
js: LitString(x) -> <javaLitString>x
|
||||
js: EscString(x) -> x
|
||||
js: Sum(x,y) -> $[[x] + [y]]
|
||||
js: Gets(x, y) -> $[[x].gets([y])]
|
||||
js: To(x, y) -> $[to([x],[y])]
|
||||
|
@ -19,6 +19,7 @@ rules
|
||||
py: Stream() -> $[Stdio]
|
||||
py: Int(x) -> x
|
||||
py: LitString(x) -> $[r[x]]
|
||||
py: EscString(x) -> x
|
||||
py: Sum(x,y) -> $[[x] + [y]]
|
||||
py: Gets(x, y) -> $[[x].gets([y])]
|
||||
py: To(x, y) -> $[to([x],[y])]
|
||||
|
@ -184,16 +184,19 @@ constructor was trivial:
|
||||
|
||||
Now typing literals is straightforward:
|
||||
```statix
|
||||
{! "\git docs/statix_works:trans/statics.stx" extract:
|
||||
start: '(.*ty_Ex.Int.*\s*)'
|
||||
stop: '/. ../'
|
||||
!}
|
||||
```
|
||||
**/
|
||||
|
||||
/** md */
|
||||
ty_Ex(Int(_)) = INT().
|
||||
ty_Ex(LitString(_)) = STRING().
|
||||
ty_Ex(EscString(_)) = STRING().
|
||||
ty_Ex(e@Stream()) = STREAM().
|
||||
/* **/
|
||||
|
||||
/** md
|
||||
```
|
||||
|
||||
Finally we get to the binary operators, and here we use the pattern found in
|
||||
recent versions of the
|
||||
|
Loading…
Reference in New Issue
Block a user