class Fexpr::Scanner

Overview

Reads and tokenizes filter expression text into a stream of tokens.

The scanner processes input character by character, recognizing tokens like:

Defined in:

fexpr/scanner.cr

Constant Summary

IDENTIFIER_REGEX = /^[\@\#\_]?[\w\.\:]*\w+$/

Regular expression for a valid identifier.

Constructors

Instance Method Summary

Constructor Detail

def self.new(io : IO) #

Creates a new scanner that reads from the given IO.


[View source]

Instance Method Detail

def comment_start_char?(ch : Char) : Bool #

Checks if a character is a valid start of a comment.


[View source]
def digit_char?(ch : Char) : Bool #

Checks if a character is a digit.


[View source]
def group_start_char?(ch : Char) : Bool #

Checks if a character is a valid start of a group/parenthesis.


[View source]
def identifier?(literal : String) : Bool #

Checks if a literal is a properly formatted identifier.


[View source]
def identifier_start_char?(ch : Char) : Bool #

Checks if a character is a valid first character of an identifier.


[View source]
def join_start_char?(ch : Char) : Bool #

Checks if a character is a valid start of a join type operator.


[View source]
def letter_char?(ch : Char) : Bool #

Checks if a character is a letter.


[View source]
def number?(literal : String) : Bool #

Checks if a literal is numeric.


[View source]
def number_start_char?(ch : Char) : Bool #

Checks if a character is a valid first character of a number.


[View source]
def reader : IO #

[View source]
def scan : TokenResult #

Returns the next token from the input stream.

If an error occurs during scanning, the returned TokenResult will contain an error message explaining what went wrong.


[View source]
def sign_start_char?(ch : Char) : Bool #

Checks if a character is a valid start of a sign operator.


[View source]
def text_start_char?(ch : Char) : Bool #

Checks if a character is a valid first character of a quoted text.


[View source]
def whitespace_char?(ch : Char) : Bool #

Checks if a character is a space, tab, or newline.


[View source]