Appearance
| 1 | namespace Syntax.Parsers.Definitions is | |
| 2 | use IO.Std; | |
| 3 | ||
| 4 | use Source; | |
| 5 | ||
| 6 | class DEFINITION( | |
| 7 | definition_namespace_parser: Parser[Trees.Definitions.NAMESPACE], | |
| 8 | definition_use_parser: Parser[Trees.Definitions.USE], | |
| 9 | definition_class_parser: Parser[Trees.Definitions.CLASS], | |
| 10 | definition_trait_parser: Parser[Trees.Definitions.TRAIT], | |
| 11 | definition_struct_parser: Parser[Trees.Definitions.STRUCT], | |
| 12 | definition_partial_parser: Parser[Trees.Definitions.PARTIAL], | |
| 13 | definition_impl_parser: Parser[Trees.Definitions.IMPL], | |
| 14 | definition_union_parser: Parser[Trees.Definitions.UNION], | |
| 15 | definition_enum_parser: Parser[Trees.Definitions.ENUM], | |
| 16 | definition_member_parser: Parser[Trees.Definitions.Definition], | |
| 17 | definition_pragma_parser: Parser[Trees.Definitions.PRAGMA] | |
| 18 | ): Base[Trees.Definitions.Definition] is | |
| 19 | description: string => "definition"; | |
| 20 | ||
| 21 | super(); | |
| 22 | ||
| 23 | init(..) is | |
| 24 | add_parsers(); | |
| 25 | si | |
| 26 | ||
| 27 | add_parsers() is | |
| 28 | add_parser( | |
| 29 | context => definition_namespace_parser.parse(context)!, | |
| 30 | Lexical.TOKEN.NAMESPACE | |
| 31 | ); | |
| 32 | ||
| 33 | add_parser( | |
| 34 | context => definition_use_parser.parse(context)!, | |
| 35 | Lexical.TOKEN.USE | |
| 36 | ); | |
| 37 | ||
| 38 | add_parser( | |
| 39 | context => definition_class_parser.parse(context)!, | |
| 40 | Lexical.TOKEN.CLASS | |
| 41 | ); | |
| 42 | ||
| 43 | add_parser( | |
| 44 | context => definition_trait_parser.parse(context)!, | |
| 45 | Lexical.TOKEN.TRAIT | |
| 46 | ); | |
| 47 | ||
| 48 | add_parser( | |
| 49 | context => definition_struct_parser.parse(context)!, | |
| 50 | Lexical.TOKEN.STRUCT | |
| 51 | ); | |
| 52 | ||
| 53 | add_parser( | |
| 54 | context => definition_partial_parser.parse(context)!, | |
| 55 | Lexical.TOKEN.PARTIAL | |
| 56 | ); | |
| 57 | ||
| 58 | add_parser( | |
| 59 | context => definition_impl_parser.parse(context)!, | |
| 60 | Lexical.TOKEN.IMPL | |
| 61 | ); | |
| 62 | ||
| 63 | add_parser( | |
| 64 | context => definition_union_parser.parse(context)!, | |
| 65 | Lexical.TOKEN.UNION | |
| 66 | ); | |
| 67 | ||
| 68 | add_parser( | |
| 69 | context => definition_enum_parser.parse(context)!, | |
| 70 | Lexical.TOKEN.ENUM | |
| 71 | ); | |
| 72 | ||
| 73 | add_parser( | |
| 74 | context => definition_member_parser.parse(context)!, | |
| 75 | Collections.LIST[Lexical.TOKEN]([Lexical.TOKEN.IDENTIFIER, Lexical.TOKEN.OPERATOR, Lexical.TOKEN.SQUARE_OPEN]) | |
| 76 | ); | |
| 77 | ||
| 78 | add_parser( | |
| 79 | context => definition_pragma_parser.parse(context)!, | |
| 80 | Lexical.TOKEN.AT | |
| 81 | ); | |
| 82 | si | |
| 83 | si | |
| 84 | si |