diff options
| author | mryouse | 2022-07-01 02:59:39 +0000 |
|---|---|---|
| committer | mryouse | 2022-07-01 02:59:39 +0000 |
| commit | ed2a063a4388ef7e315f4d7b9e59405b9aad71e4 (patch) | |
| tree | 5e2c9e808ccf5963e55598b5eb6e2903b126d08e /neb/parser.py | |
| parent | bf8900200c25d383c883501446a8048ad8966d94 (diff) | |
Revert "initial commit of multi-type support (only list of strings for now)"
This reverts commit bf8900200c25d383c883501446a8048ad8966d94.
Diffstat (limited to 'neb/parser.py')
| -rw-r--r-- | neb/parser.py | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/neb/parser.py b/neb/parser.py index 10c6633..bbaf7a8 100644 --- a/neb/parser.py +++ b/neb/parser.py @@ -45,19 +45,8 @@ def parseLiteral(token, prev, tokens): def parseType(token, prev, tokens): # if the next token is a symbol, combine for a type - if tokens[0].type_ == TokenType.SYMBOL: + if len(tokens) > 0 and tokens[0].type_ == TokenType.SYMBOL: return Type(f":{tokens[0].text}"), 2 - elif tokens[0].type_ == TokenType.OPEN_BRACKET: - # only format currently supported: - # [ <type> ] - if tokens[1].type_ != TokenType.COLON: - raise ParseError("invalid type definition (expecting colon)", tokens[1].line) - typ, counter = parseType(tokens[1], tokens[0], tokens[2:]) - if tokens[1+counter].type_ != TokenType.CLOSE_BRACKET: - raise ParseError("invalid type definition (expecting close bracket)", tokens[1+counter].line) - return MultiType(f":[{typ.name}]", typ), counter + 3 - else: - raise ParseError("invalid type definition!", tokens[0].line) def parse(tokens): idx = 0 |
