class TopDown::Parser::ParseletLiteral

Overview

This type is used for documentation purpose only. It represents an element to parse inside macro.

Could be one of the following:

parse('💎')
parse("foo")
parse(/\d+/, &.to_i)
parse(/"(([^"\\]|\\.)*)"/) { $1 }
parse(:expression)
parse(["+="])

parse("foo" | :value | '💎')
# equivalent to:
union do
 parse("foo")
 parse(:value)
 parse('💎')
end

parse(any)        # any char except '\0'
parse([any])      # any token except EOF
parse(not('\n'))  # any char except '\n' & EOF
parse(not(["+"])) # any token except "+" & EOF
parse(not("foo")) # any char or fail on "foo".

See Parser.parse.

Defined in:

parser/parselets.cr