|
71 | 71 | OpenParserYamlError* = object of CatchableError |
72 | 72 | ## Exception type for errors encountered during YAML parsing or dumping |
73 | 73 |
|
74 | | -proc newYamlLexer*(input: string): YamlLexer = |
75 | | - ## Create a new YamlLexer for the given input string |
76 | | - YamlLexer(input: input, len: input.len, line: 1, col: 1) |
77 | | - |
78 | | -proc charAt(l: YamlLexer, idx: int): char {.inline.} = |
79 | | - if idx < 0 or idx >= l.len: return '\0' |
80 | | - else: return l.input[idx] |
81 | | - |
82 | 74 | const |
83 | 75 | invalidToken = "Invalid token `$1`" |
84 | 76 | errorEndOfFile = "Unexpected EOF while parsing `$1`" |
85 | 77 | unexpectedToken = "Unexpected token `$1`" |
86 | 78 | unexpectedTokenExpected = "Got `$1`, expected $2" |
87 | 79 | unexpectedChar = "Unexpected character `$1`" |
88 | 80 |
|
| 81 | +proc newYamlLexer*(input: string): YamlLexer = |
| 82 | + ## Create a new YamlLexer for the given input string |
| 83 | + YamlLexer(input: input, len: input.len, line: 1, col: 1) |
| 84 | + |
| 85 | +proc charAt(l: YamlLexer, idx: int): char {.inline.} = |
| 86 | + if idx < 0 or idx >= l.len: return '\0' |
| 87 | + else: return l.input[idx] |
89 | 88 |
|
90 | 89 | proc getContext(l: YamlLexer, posOverride: int = -1): string = |
91 | 90 | # Show the full current line and place caret at exact token position. |
|
0 commit comments