Support `export` as an alias for `pub`
e6e66a535d3c4ee248e965687d9b5eed0625631f5d606cfc64c2c8c7c9378165
We will eventually remove `pub`.
1 parent
5712ca7c
lib/std/lang/parser.rad
+1 -1
| 874 | 874 | let mut attrs = ast::nodeSlice(p.arena, 4); |
|
| 875 | 875 | ||
| 876 | 876 | if let attr = tryParseAnnotation(p) { |
|
| 877 | 877 | attrs.append(attr, p.allocator); |
|
| 878 | 878 | } |
|
| 879 | - | if consume(p, scanner::TokenKind::Pub) { |
|
| 879 | + | if consume(p, scanner::TokenKind::Pub) or consume(p, scanner::TokenKind::Export) { |
|
| 880 | 880 | let attrNode = nodeAttribute(p, ast::Attribute::Pub); |
|
| 881 | 881 | attrs.append(attrNode, p.allocator); |
|
| 882 | 882 | } |
|
| 883 | 883 | if consume(p, scanner::TokenKind::Extern) { |
|
| 884 | 884 | let attrNode = nodeAttribute(p, ast::Attribute::Extern); |
lib/std/lang/scanner.rad
+3 -2
| 95 | 95 | ||
| 96 | 96 | // Module-related tokens. |
|
| 97 | 97 | Mod, Use, Super, |
|
| 98 | 98 | ||
| 99 | 99 | // Type or function attributes. |
|
| 100 | - | Pub, Extern, Static, |
|
| 100 | + | Pub, Export, Extern, Static, |
|
| 101 | 101 | ||
| 102 | 102 | // Trait-related tokens. |
|
| 103 | 103 | Trait, Instance, |
|
| 104 | 104 | ||
| 105 | 105 | // Type-related tokens. |
| 114 | 114 | /// Corresponding token. |
|
| 115 | 115 | tok: TokenKind, |
|
| 116 | 116 | } |
|
| 117 | 117 | ||
| 118 | 118 | /// Sorted keyword table for binary search. |
|
| 119 | - | const KEYWORDS: [Keyword; 51] = [ |
|
| 119 | + | const KEYWORDS: [Keyword; 52] = [ |
|
| 120 | 120 | { name: "align", tok: TokenKind::Align }, |
|
| 121 | 121 | { name: "and", tok: TokenKind::And }, |
|
| 122 | 122 | { name: "as", tok: TokenKind::As }, |
|
| 123 | 123 | { name: "assert", tok: TokenKind::Assert }, |
|
| 124 | 124 | { name: "bool", tok: TokenKind::Bool }, |
| 126 | 126 | { name: "case", tok: TokenKind::Case }, |
|
| 127 | 127 | { name: "catch", tok: TokenKind::Catch }, |
|
| 128 | 128 | { name: "const", tok: TokenKind::Const }, |
|
| 129 | 129 | { name: "continue", tok: TokenKind::Continue }, |
|
| 130 | 130 | { name: "else", tok: TokenKind::Else }, |
|
| 131 | + | { name: "export", tok: TokenKind::Export }, |
|
| 131 | 132 | { name: "extern", tok: TokenKind::Extern }, |
|
| 132 | 133 | { name: "false", tok: TokenKind::False }, |
|
| 133 | 134 | { name: "fn", tok: TokenKind::Fn }, |
|
| 134 | 135 | { name: "for", tok: TokenKind::For }, |
|
| 135 | 136 | { name: "i16", tok: TokenKind::I16 }, |