aboutsummaryrefslogtreecommitdiff
path: root/compiler/elymasLexer.ey
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-07-21 19:41:15 +0200
committerDrahflow <drahflow@gmx.de>2013-07-21 19:41:15 +0200
commit81fcdfadb2e396183ff30f6e8e6b03b7df004dc4 (patch)
tree788fa7bc99b4d1c382fd1b64a1f9026c857fea56 /compiler/elymasLexer.ey
parent4a46857667d2ddfd43cf9b6218ff3399ceb500c9 (diff)
implemented include
Diffstat (limited to 'compiler/elymasLexer.ey')
-rw-r--r--compiler/elymasLexer.ey46
1 files changed, 2 insertions, 44 deletions
diff --git a/compiler/elymasLexer.ey b/compiler/elymasLexer.ey
index a140769..77ae81b 100644
--- a/compiler/elymasLexer.ey
+++ b/compiler/elymasLexer.ey
@@ -1,21 +1,10 @@
<
- [ /0 /1 /2 /3 /4 /5 /6 /7 /8 /9 ] ==digits
-
- { 0 ==result
- { "(.)(.*)" regex } {
- { streq }_ digits -01 index result 10 mul add =result
- } loop
- result
- }
-> -- /base10decode deff
-
-<
{ assembler -01 . } ":" deff
{ assemblerLibrary -01 . } "::" deff
assembler .|label "@" deff
"%" _ : -01 deff
- { .value base10decode ==v
+ { .value elymas .base10decode ==v
[
# allocate int
16 /rdi :movqImmReg
@@ -44,43 +33,12 @@
} /TOKID
> -- 3 |defv rep
-{ /f deff -101 /s defv regex { f } { s } ? * } /rxparse deff
-
-{ " " cat
- { < /handle deff /value defv > } /token deff
- [ -01 { _ "" streq not } {
- 0 /matched defv { /f deff matched { -- } { { 1 =matched f } rxparse } ? * } /parse deff
-
- "^ (.*)" { } parse
- "^#" { "" } parse
- "^(\\d+) +(.*)" { TOKINT token -01 } parse
- "^\"(.*)" {
- "" /str defv
- { _ "^\"(.*)" regex { -01 -- 0 } { 1 } ? * } {
- 0 /strmatched defv { /f deff strmatched { -- } { { 1 =strmatched f } rxparse } ? * } /strparse deff
-
- "^\\\\\\\\(.*)" { str "\\" cat =str } strparse
- "^\\\\n(.*)" { str "\n" cat =str } strparse
- "^\\\\0(.*)" { str "\0" cat =str } strparse
- "^\\\\\"(.*)" { str "\"" cat =str } strparse
- "^([^\"\\\\])(.*)" { str -01 cat =str } strparse
- strmatched not { "Tokenization of string-like failed" die } rep
- } loop
- str TOKSTR token -01
- } parse
- "^([^a-zA-Z0-9 ]+)([a-zA-Z0-9][^ ]*) +(.*)" { -201 TOKSTR token " " -1203 cat cat } parse
- "^([a-zA-Z0-9]+|[^a-zA-Z0-9 ]+) +(.*)" { TOKID token -01 } parse
-
- matched not { "Tokenization failed: " -01 cat die } rep
- } loop -- ]
-} /tokenize deff
-
{ /input defv
"" {
4096 input .readstr cat
_ "" streq not
} {
- { _ "([^\\n]*)\\n(.*)" regex } { -102 -- tokenize {
+ { _ "([^\\n]*)\\n(.*)" regex } { -102 -- TOKINT TOKSTR TOKID elymas .tokenize {
_ .handle
# assemblerLibrary .stackDump
# assemblerLibrary .globalScopeDump