Appearance
| 1 | namespace Syntax.Parsers.Definitions is | |
| 2 | ||
| 3 | use Source; | |
| 4 | ||
| 5 | class USE(identifier_qualified_parser: Parser[Trees.Identifiers.Identifier]): Base[Trees.Definitions.USE] is | |
| 6 | super(); | |
| 7 | ||
| 8 | parse(context: CONTEXT) -> Trees.Definitions.USE is | |
| 9 | let start = context.location; | |
| 10 | ||
| 11 | context.next_token(Lexical.TOKEN.USE); | |
| 12 | ||
| 13 | let `use mut = identifier_qualified_parser.parse(context); | |
| 14 | ||
| 15 | if !`use? then | |
| 16 | return Trees.Definitions.USE(start::context.location, null, null); | |
| 17 | elif context.current_token == Lexical.TOKEN.ASSIGN then | |
| 18 | context.next_token(); | |
| 19 | ||
| 20 | let name = `use; | |
| 21 | ||
| 22 | if let name.qualifier? then | |
| 23 | context.logger.error(qualifier.location, "cannot qualify namespace or symbol alias"); | |
| 24 | fi | |
| 25 | ||
| 26 | `use = identifier_qualified_parser.parse(context); | |
| 27 | ||
| 28 | if `use? then | |
| 29 | context.next_token(Lexical.TOKEN.SEMICOLON); | |
| 30 | fi | |
| 31 | ||
| 32 | return Trees.Definitions.USE(start::context.location, name, `use); | |
| 33 | else | |
| 34 | context.next_token(Lexical.TOKEN.SEMICOLON); | |
| 35 | ||
| 36 | return Trees.Definitions.USE(start::context.location, null, `use); | |
| 37 | fi | |
| 38 | si | |
| 39 | si | |
| 40 | si |