UNPKG

@secam/pgsql-ast-parser

Version:

Fork of pgsql-ast-parser Simple Postgres SQL parser/modifier for pg-mem

27 lines (23 loc) 552 B
import {compile} from 'moo'; // build lexer export const lexer = compile({ comma: ',', space: { match: /[\s\t\n\v\f\r]+/, lineBreaks: true, }, int: /\-?\d+(?![\.\d])/, float: /\-?(?:(?:\d*\.\d+)|(?:\d+\.\d*))/, lcurl: '{', rcurl: '}', lparen: '(', rparen: ')', lbracket: '[', rbracket: ']', lcomp: '<', rcomp: '>', }); lexer.next = (next => () => { let tok; while ((tok = next.call(lexer)) && (tok.type === 'space')) { } return tok; })(lexer.next); export const lexerAny: any = lexer;