Class: Hamlit::Parser

Constant Summary collapse

SKIP_NEWLINE_EXPS =
%i[newline code multi].freeze
SKIP_NEWLINE_FILTERS =
%w[ruby markdown erb].freeze

Constants included from Hamlit::Parsers::Tag

Hamlit::Parsers::Tag::DEFAULT_TAG, Hamlit::Parsers::Tag::TAG_ID_CLASS_REGEXP, Hamlit::Parsers::Tag::TAG_REGEXP

Constants included from Hamlit::Parsers::Script

Hamlit::Parsers::Script::DEFAULT_SCRIPT_OPTIONS, Hamlit::Parsers::Script::INTERNAL_STATEMENTS, Hamlit::Parsers::Script::PREFIX_BY_STATEMENT

Constants included from Hamlit::Parsers::Multiline

Hamlit::Parsers::Multiline::SPACED_BLOCK_REGEXP

Constants included from Hamlit::Parsers::Attribute

Hamlit::Parsers::Attribute::ATTRIBUTE_BEGIN, Hamlit::Parsers::Attribute::BALANCE_START_COUNT, Hamlit::Parsers::Attribute::METHOD_CALL_PREFIX

Constants included from Concerns::Lexable

Concerns::Lexable::TYPE_POSITION

Instance Method Summary collapse

Methods included from Hamlit::Parsers::Text

#parse_text

Methods included from Concerns::Error

#assert_scan!, #copmile_error!, #syntax_error, #syntax_error!

Methods included from Hamlit::Parsers::Tag

#parse_tag

Methods included from Concerns::Whitespace

#parse_whitespace_removal, #remove_first_space!, #remove_last_space!

Methods included from Concerns::Indentable

#count_indent, #has_block?, #next_indent, #reset_indent, #same_indent?, #validate_indentation!, #with_indented

Methods included from Hamlit::Parsers::Script

#parse_script, #parse_silent_script

Methods included from Concerns::Included

extended

Methods included from Hamlit::Parsers::Multiline

#preprocess_multilines

Methods included from Concerns::LineReader

#current_line, #empty_line?, #next_line, #read_lines, #reset_lines, #skip_lines

Methods included from Hamlit::Parsers::Filter

#parse_filter

Methods included from Hamlit::Parsers::Doctype

#parse_doctype

Methods included from Hamlit::Parsers::Comment

#parse_comment

Methods included from Hamlit::Parsers::Attribute

#parse_attributes

Methods included from Concerns::Lexable

#convert_position, #skip_tokens!, #type_of

Methods included from Concerns::Balanceable

#balanced_braces_exist?, #balanced_embexprs_exist?, #balanced_parens_exist?, #fetch_balanced_braces, #fetch_balanced_embexprs, #fetch_balanced_parentheses

Instance Method Details

#call(template) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/hamlit/parser.rb', line 28

def call(template)
  reset(template)

  ast = [:multi]
  ast += parse_lines
  ast
end