Obelisk::Lexers::JSON
Inherits Obelisk::RegexLexer < Obelisk::Lexer < Reference < Object
JSON lexer Optimized with regex constants following Chroma-like patterns
Constants
ANY_CHAR = /./
Error
BRACES = /[{}]/
Punctuation
BRACKETS = /[\[\]]/
COLON = /:/
COMMA = /,/
DOUBLE_QUOTE = /"/
String delimiters
ESCAPE_INVALID = /\\./
ESCAPE_SIMPLE = /\\["\\\/bfnrt]/
Escape sequences (shared pattern)
ESCAPE_UNICODE = /\\u[0-9a-fA-F]{4}/
FALSE = /\bfalse\b/
NULL = /\bnull\b/
NUMBER = /-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/
Numbers (Chroma pattern: -?(0|[1-9]\d*)(.\d+)?([eE][+-]?\d+)?)
STRING_CONTENT = /[^"\\]+/
String content (excluding quotes and escapes)
TRUE = /\btrue\b/
Constants
WHITESPACE = /\s+/
Whitespace
Instance methods
Analyze text to determine if this lexer can handle it Returns a score from 0.0 to 1.0
config
Sourcerules
Source