aboutsummaryrefslogtreecommitdiff
path: root/src/cljcc/lexer.clj
diff options
context:
space:
mode:
authorShagun Agrawal <agrawalshagun07@gmail.com>2024-11-16 15:23:17 +0530
committerShagun Agrawal <agrawalshagun07@gmail.com>2024-11-16 15:23:17 +0530
commit8d981ffc2d59691d9cccf635ef143979fb0f2b9a (patch)
tree3707c43df2bca3d7c9dfb37f3116fd4b9aed2bf2 /src/cljcc/lexer.clj
parente7687ad8371977b827f8f3be8371e8beabee3d0c (diff)
Lexing and parsing stage for long type specifier
Add long and parser type specifiers Add malli schema for parsing stage
Diffstat (limited to 'src/cljcc/lexer.clj')
-rw-r--r--src/cljcc/lexer.clj17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/cljcc/lexer.clj b/src/cljcc/lexer.clj
index f1b0a2a..d092ea6 100644
--- a/src/cljcc/lexer.clj
+++ b/src/cljcc/lexer.clj
@@ -43,7 +43,7 @@
(-> ctx
(update :col inc)))
(digit? ch) (let [[chrs rst] (split-with letter-digit? source)
- number (read-number (apply str chrs))
+ number (read-number (apply str chrs) line col)
cnt (count chrs)
npos (+ pos cnt)
token (t/create :number line col number)]
@@ -67,14 +67,11 @@
(comment
- (lex "int main(void) {return int a = 2; a <<= 2;}")
-
-
- (lex "
- extern int a;
-
- int main(void) {
- return 42};")
-
+ (lex
+ "
+int main() {
+ long a = 110;
+}
+")
())