From dff8878c13610ae8d1207aaabefbecc88cd3911f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 28 Jul 2018 13:36:49 -0400 Subject: Temporary commit to get rid of "+" signs for Nat. --- luxc/src/lux/lexer.clj | 7 ++++--- luxc/src/lux/parser.clj | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'luxc/src') diff --git a/luxc/src/lux/lexer.clj b/luxc/src/lux/lexer.clj index 354bf98e2..73bcb4f22 100644 --- a/luxc/src/lux/lexer.clj +++ b/luxc/src/lux/lexer.clj @@ -130,7 +130,7 @@ (|do [[meta _ token] (&reader/read-regex )] (return (&/T [meta ( token)])))) - lex-bit $Bit #"^(#0|#1)" + lex-bit $Bit #"^#(0|1)" ) (do-template [ ] @@ -138,10 +138,11 @@ (|do [[meta _ token] (&reader/read-regex )] (return (&/T [meta ( (string/replace token #"_" ""))])))) - lex-nat $Nat #"^\+[0-9][0-9_]*" + ;; (-|\+) + lex-nat $Nat #"^\|[0-9][0-9_]*" lex-int $Int #"^-?[0-9][0-9_]*" lex-rev $Rev #"^\.[0-9][0-9_]*" - lex-frac $Frac #"^-?[0-9][0-9_]*\.[0-9_]+((e|E)(-|\+)?[0-9][0-9_]*)?" + lex-frac $Frac #"^-?[0-9][0-9_]*\.[0-9][0-9_]*((e|E)(-|\+)[0-9][0-9_]*)?" ) (def +same-module-mark+ (str &/+name-separator+ &/+name-separator+)) diff --git a/luxc/src/lux/parser.clj b/luxc/src/lux/parser.clj index dd33129b8..5303327c8 100644 --- a/luxc/src/lux/parser.clj +++ b/luxc/src/lux/parser.clj @@ -68,7 +68,7 @@ (return (&/|list (&/T [meta (&/$Bit (.equals ^String ?value "#1"))]))) (&lexer/$Nat ?value) - (return (&/|list (&/T [meta (&/$Nat (Long/parseUnsignedLong ?value))]))) + (return (&/|list (&/T [meta (&/$Nat (Long/parseUnsignedLong (.substring ^String ?value 1)))]))) (&lexer/$Int ?value) (return (&/|list (&/T [meta (&/$Int (Long/parseLong ?value))]))) -- cgit v1.2.3 From 15e71e57b688f5079fe606b2fee5e3efd2a5d5a7 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 28 Jul 2018 14:55:30 -0400 Subject: Added "+" sign to positive Int. --- luxc/src/lux/lexer.clj | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'luxc/src') diff --git a/luxc/src/lux/lexer.clj b/luxc/src/lux/lexer.clj index 73bcb4f22..dbbfc3d2e 100644 --- a/luxc/src/lux/lexer.clj +++ b/luxc/src/lux/lexer.clj @@ -138,11 +138,10 @@ (|do [[meta _ token] (&reader/read-regex )] (return (&/T [meta ( (string/replace token #"_" ""))])))) - ;; (-|\+) lex-nat $Nat #"^\|[0-9][0-9_]*" - lex-int $Int #"^-?[0-9][0-9_]*" + lex-int $Int #"^(-|\+)[0-9][0-9_]*" lex-rev $Rev #"^\.[0-9][0-9_]*" - lex-frac $Frac #"^-?[0-9][0-9_]*\.[0-9][0-9_]*((e|E)(-|\+)[0-9][0-9_]*)?" + lex-frac $Frac #"^(-|\+)[0-9][0-9_]*\.[0-9][0-9_]*((e|E)(-|\+)[0-9][0-9_]*)?" ) (def +same-module-mark+ (str &/+name-separator+ &/+name-separator+)) -- cgit v1.2.3 From e6db62dbd6529938dace0e1cf5743f4e985efb81 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 28 Jul 2018 15:39:06 -0400 Subject: Removed temporary "|" prefix on Nat. --- luxc/src/lux/lexer.clj | 2 +- luxc/src/lux/parser.clj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'luxc/src') diff --git a/luxc/src/lux/lexer.clj b/luxc/src/lux/lexer.clj index dbbfc3d2e..f74e14dfd 100644 --- a/luxc/src/lux/lexer.clj +++ b/luxc/src/lux/lexer.clj @@ -138,7 +138,7 @@ (|do [[meta _ token] (&reader/read-regex )] (return (&/T [meta ( (string/replace token #"_" ""))])))) - lex-nat $Nat #"^\|[0-9][0-9_]*" + lex-nat $Nat #"^[0-9][0-9_]*" lex-int $Int #"^(-|\+)[0-9][0-9_]*" lex-rev $Rev #"^\.[0-9][0-9_]*" lex-frac $Frac #"^(-|\+)[0-9][0-9_]*\.[0-9][0-9_]*((e|E)(-|\+)[0-9][0-9_]*)?" diff --git a/luxc/src/lux/parser.clj b/luxc/src/lux/parser.clj index 5303327c8..dd33129b8 100644 --- a/luxc/src/lux/parser.clj +++ b/luxc/src/lux/parser.clj @@ -68,7 +68,7 @@ (return (&/|list (&/T [meta (&/$Bit (.equals ^String ?value "#1"))]))) (&lexer/$Nat ?value) - (return (&/|list (&/T [meta (&/$Nat (Long/parseUnsignedLong (.substring ^String ?value 1)))]))) + (return (&/|list (&/T [meta (&/$Nat (Long/parseUnsignedLong ?value))]))) (&lexer/$Int ?value) (return (&/|list (&/T [meta (&/$Int (Long/parseLong ?value))]))) -- cgit v1.2.3