Chevrotain
Home
Features
Tutorial
Guide
FAQ
Changes
APIs
Playground
Benchmark
Discussions
GitHub
Home
Features
Tutorial
Guide
FAQ
Changes
APIs
Playground
Benchmark
Discussions
GitHub
  • Features

    • Blazing Fast
    • LL(K) Grammars
    • Separation of Grammar and Semantics
    • Easy Debugging
    • Fault Tolerance
    • Multiple Start Rules
    • Customizable Error Messages
    • Parameterized Rules
    • Gates
    • Syntactic Content Assist
    • Grammar Inheritance
    • Backtracking
    • Syntax Diagrams
    • RegExp Based Lexers
    • Position Tracking
    • Token Alternative Matches
    • Token Skipping
    • Token Categories
    • Token Grouping
    • Custom Token Patterns
    • Lexer Modes

Token Skipping

Chevrotain support ignoring specific Token Types. This means that these Token Types would be lexed but would not appear in the Token Vector the lexer produces. This capability is often used to ignore certain types of Tokens most commonly whitespace.

To skip a Token define its group as the special Lexer.SKIPPED For example:

import { createToken, Lexer } from "chevrotain";
const WhiteSpace = createToken({
  name: "WhiteSpace",
  pattern: /\s+/,
  group: Lexer.SKIPPED,
});
Edit this page on GitHub
Last Updated: 7/9/23, 12:55 AM
Contributors: Shahar Soel, bd82
Prev
Token Alternative Matches
Next
Token Categories