ut-plsql-lexer
v1.7.1
Published
PL/SQL lexer and linter
Downloads
2
Readme
PL/SQL lexer and linter
API
try {
let parsed = require('ut-plsql-lexer').parse('select * FROM someTable');
parsed.lint.forEach(({
startLine,
startColumn,
endLine,
endColumn,
code,
message,
text
}) => {
// process lint warnings
});
parsed.tokens.forEach(line => {
line.forEach(({
type, // whitespace, newline, comment, literal, system, globaltemp,
// temp, variable, keyword, word, paren, operator
text,
location
}) => {
// process tokens of each line of source code
});
});
} catch ({message, location}) {
// process parse errors
}
Lint rules
uppercase-keywords
: Keywords must be in uppercaseindent-size
: Indentation must be multiple of 4no-trailing-whitespace
: Trailing whitespace not allowedsingle-whitespace
: Non indentation should be with single spacenewline-required
: Newline required at end of filewhitespace-around
: Operator should be surrounded with single spacewhitespace-after
: Operator should be followed by single spaceindent-step
: Indentation step must not exceed 4indent-same
: Lines starting with non-keyword must have same indentationindent-increase
: Lines starting with non-keyword after lines starting with keyword must increase indentationindent-after-begin
: Line after BEGIN must increase indentation with 4