1.5.4 • Published 7 months ago

ut-tsql-lexer v1.5.4

Weekly downloads
10
License
Apache-2.0
Repository
github
Last release
7 months ago

Transact SQL lexer and linter

API

try {
    let parsed = require('ut-tsql-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

  • upppercase-keywords: Keywords must be in uppercase
  • no-doublequotes: Must use ... instead of "..."
  • indent-size: Indentation must be multiple of 4
  • no-trailing-whitespace: Trailing whitespace not allowed
  • single-whitespace: Non indentation should be with single space
  • newline-required: Newline required at end of file
  • whitespace-around: Operator should be surrounded with single space
  • whitespace-after: Operator should be followed by single space
  • indent-step: Indentation step must not exceed 4
  • indent-same: Lines starting with non-keyword must have same indentation
  • indent-increase: Lines starting with non-keyword after lines starting with keyword must increase indentation
  • indent-after-begin: Line after BEGIN must increase indentation with 4
1.5.4

7 months ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago