1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

@ for escaping keywords

This commit is contained in:
Alexander Medvednikov
2019-07-24 02:22:34 +02:00
parent facf55cbc0
commit c28a490c17
4 changed files with 21 additions and 6 deletions

View File

@ -388,6 +388,13 @@ fn (s mut Scanner) scan() ScanRes {
return scan_res(.pipe, '')
case `,`:
return scan_res(.comma, '')
case `@`:
s.pos++
name := s.ident_name()
if !is_key(name) {
s.error('@ must be used before keywords (e.g. `@type string`)')
}
return scan_res(.name, name)
case `\r`:
if nextc == `\n` {
s.pos++