Scan scans the next token and populates its information into lval. This scan function contains rules for plpgsql.
(lval ScanSymType)
| 21 | // Scan scans the next token and populates its information into lval. |
| 22 | // This scan function contains rules for plpgsql. |
| 23 | func (s *PLpgSQLScanner) Scan(lval ScanSymType) { |
| 24 | ch, skipWhiteSpace := s.scanSetup(lval, true /* allowComments */) |
| 25 | |
| 26 | if skipWhiteSpace { |
| 27 | return |
| 28 | } |
| 29 | |
| 30 | switch ch { |
| 31 | case '$': |
| 32 | if s.scanDollarQuotedString(lval) { |
| 33 | lval.SetID(lexbase.SCONST) |
| 34 | return |
| 35 | } |
| 36 | return |
| 37 | |
| 38 | case identQuote: |
| 39 | // "[^"]" |
| 40 | if s.scanString(lval, identQuote, false /* allowEscapes */, true /* requireUTF8 */) { |
| 41 | lval.SetID(lexbase.IDENT) |
| 42 | } |
| 43 | return |
| 44 | |
| 45 | case singleQuote: |
| 46 | // '[^']' |
| 47 | if s.scanString(lval, ch, false /* allowEscapes */, true /* requireUTF8 */) { |
| 48 | lval.SetID(lexbase.SCONST) |
| 49 | } |
| 50 | return |
| 51 | |
| 52 | case 'b': |
| 53 | // Bytes? |
| 54 | if s.peek() == singleQuote { |
| 55 | // b'[^']' |
| 56 | s.pos++ |
| 57 | if s.scanString(lval, singleQuote, true /* allowEscapes */, false /* requireUTF8 */) { |
| 58 | lval.SetID(lexbase.BCONST) |
| 59 | } |
| 60 | return |
| 61 | } |
| 62 | s.scanIdent(lval) |
| 63 | return |
| 64 | |
| 65 | case 'e', 'E': |
| 66 | // Escaped string? |
| 67 | if s.peek() == singleQuote { |
| 68 | // [eE]'[^']' |
| 69 | s.lastAttemptedID = int32(lexbase.SCONST) |
| 70 | s.pos++ |
| 71 | if s.scanString(lval, singleQuote, true /* allowEscapes */, true /* requireUTF8 */) { |
| 72 | lval.SetID(lexbase.SCONST) |
| 73 | } |
| 74 | return |
| 75 | } |
| 76 | s.scanIdent(lval) |
| 77 | return |
| 78 | |
| 79 | case '.': |
| 80 | switch t := s.peek(); { |
nothing calls this directly
no test coverage detected