Skip to content

Commit ba838a8

Browse files
committed
use std submodule
1 parent 3a156d0 commit ba838a8

File tree

5 files changed

+22
-66
lines changed

5 files changed

+22
-66
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "std"]
2+
path = std
3+
url = https://github.com/callisto-lang/std

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ dub build
88
```
99

1010
## Try it
11+
Note: to use the example programs, you will need the `std` submodule in this repository,
12+
which you can get by cloning recursively or
13+
doing `git submodule update --init --remote --recursive`
14+
1115
Currently whatever is being tested is in
1216
test.cal, compile it with these commands:
1317
```

cores/rm86.cal

-58
This file was deleted.

source/lexer.d

+14-8
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ class Lexer {
6767
}
6868
}
6969

70+
void HandleColLine() {
71+
if (code[i] == '\n') {
72+
++ line;
73+
col = 0;
74+
}
75+
else {
76+
++ col;
77+
}
78+
}
79+
7080
void Lex() {
7181
char[char] escapes = [
7282
'n': '\n',
@@ -76,19 +86,13 @@ class Lexer {
7686
];
7787

7888
for (i = 0; i < code.length; ++ i) {
79-
if (code[i] == '\n') {
80-
++ line;
81-
col = 0;
82-
}
83-
else {
84-
++ col;
85-
}
86-
8789
if (inString) {
8890
switch (code[i]) {
8991
case '\\': {
9092
++ i;
9193

94+
HandleColLine();
95+
9296
if (i >= code.length) {
9397
Error("Unexpected EOF");
9498
}
@@ -128,6 +132,8 @@ class Lexer {
128132
}
129133
}
130134
}
135+
136+
HandleColLine();
131137
}
132138
}
133139
}

std

Submodule std added at 8cb3e3b

0 commit comments

Comments
 (0)