Skip to content

Commit 254ca83

Browse files
authored
Update Core lexer to incorporate change of keyword from use to import (#1124)
This is incorporating the language change that happened in https://codeberg.org/core-lang/core/issues/102/.
1 parent 2d9c0d1 commit 254ca83

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

lexers/embedded/core.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<rule pattern="(fun|let|var)\b">
2020
<token type="KeywordDeclaration"/>
2121
</rule>
22-
<rule pattern="(mod|use)\b">
22+
<rule pattern="(mod|import)\b">
2323
<token type="KeywordNamespace"/>
2424
</rule>
2525
<rule pattern="(if|else|is|for|in|while|return)\b">

lexers/testdata/core.actual

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@pub use collections.{Array, BitSet, BitVec, HashMap, HashSet, List, Queue};
1+
import collections.{Array, BitSet, BitVec, HashMap, HashSet, List, Queue}
22

33
@pub mod annotations;
44

@@ -148,8 +148,8 @@ impl StacktraceElement {
148148
None,
149149
}
150150

151-
use Option.Some
152-
use Option.None
151+
import Option.Some
152+
import Option.None
153153

154154
impl[T] Option[T] {
155155
@pub fun isNone: Bool = if self
@@ -173,8 +173,8 @@ impl[T] Option[Option[T]] {
173173
Fail(E),
174174
}
175175

176-
use Result.Pass
177-
use Result.Fail
176+
import Result.Pass
177+
import Result.Fail
178178

179179
impl[T, E] Result[T, E] {
180180
@pub fun isPass: Bool = if self

lexers/testdata/core.expected

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[
2-
{"type":"NameAttribute","value":"@pub"},
3-
{"type":"TextWhitespace","value":" "},
4-
{"type":"KeywordNamespace","value":"use"},
2+
{"type":"KeywordNamespace","value":"import"},
53
{"type":"TextWhitespace","value":" "},
64
{"type":"Name","value":"collections"},
75
{"type":"Operator","value":"."},
@@ -26,7 +24,6 @@
2624
{"type":"TextWhitespace","value":" "},
2725
{"type":"NameClass","value":"Queue"},
2826
{"type":"Punctuation","value":"}"},
29-
{"type":"Operator","value":";"},
3027
{"type":"TextWhitespace","value":"\n\n"},
3128
{"type":"NameAttribute","value":"@pub"},
3229
{"type":"TextWhitespace","value":" "},
@@ -1004,13 +1001,13 @@
10041001
{"type":"TextWhitespace","value":"\n"},
10051002
{"type":"Punctuation","value":"}"},
10061003
{"type":"TextWhitespace","value":"\n\n"},
1007-
{"type":"KeywordNamespace","value":"use"},
1004+
{"type":"KeywordNamespace","value":"import"},
10081005
{"type":"TextWhitespace","value":" "},
10091006
{"type":"NameClass","value":"Option"},
10101007
{"type":"Operator","value":"."},
10111008
{"type":"NameClass","value":"Some"},
10121009
{"type":"TextWhitespace","value":"\n"},
1013-
{"type":"KeywordNamespace","value":"use"},
1010+
{"type":"KeywordNamespace","value":"import"},
10141011
{"type":"TextWhitespace","value":" "},
10151012
{"type":"NameClass","value":"Option"},
10161013
{"type":"Operator","value":"."},
@@ -1209,13 +1206,13 @@
12091206
{"type":"TextWhitespace","value":"\n"},
12101207
{"type":"Punctuation","value":"}"},
12111208
{"type":"TextWhitespace","value":"\n\n"},
1212-
{"type":"KeywordNamespace","value":"use"},
1209+
{"type":"KeywordNamespace","value":"import"},
12131210
{"type":"TextWhitespace","value":" "},
12141211
{"type":"NameClass","value":"Result"},
12151212
{"type":"Operator","value":"."},
12161213
{"type":"NameClass","value":"Pass"},
12171214
{"type":"TextWhitespace","value":"\n"},
1218-
{"type":"KeywordNamespace","value":"use"},
1215+
{"type":"KeywordNamespace","value":"import"},
12191216
{"type":"TextWhitespace","value":" "},
12201217
{"type":"NameClass","value":"Result"},
12211218
{"type":"Operator","value":"."},

0 commit comments

Comments
 (0)