Class: Kwartz::CssStyleParser
- Inherits:
-
PresentationLogicParser
- Object
- PresentationLogicParser
- Kwartz::CssStyleParser
- Defined in:
- lib/kwartz/parser.rb
Overview
css style presentation logic parser
example of presentation logic in css style:
// comment
#list {
value: @var;
attrs: "class" @classname, "bgcolro" color;
append: @value==item['list'] ? ' checked' : '';
logic: {
@list.each { |item|
_stag
_cont
_etag
}
}
}
Constant Summary
Constants inherited from PresentationLogicParser
PresentationLogicParser::ESCAPE_FLAG_TABLE, PresentationLogicParser::PLOGIC_KEYWORDS
Instance Attribute Summary
Attributes inherited from PresentationLogicParser
#column, #error, #linenum, #pos, #token, #value
Instance Method Summary collapse
Methods inherited from PresentationLogicParser
#escape?, get_class, #getch, #initialize, #parse_error, register_class, #scan, #scan_block, #scan_ident, #scan_line, #scan_string, #scan_string_dquoted, #scan_string_quoted
Methods included from Assertion
Methods included from CharacterType
#is_alpha, #is_digit, #is_identchar, #is_whitespace
Constructor Details
This class inherits a constructor from Kwartz::PresentationLogicParser
Instance Method Details
#parse(input, filename = '') ⇒ Object
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 |
# File 'lib/kwartz/parser.rb', line 603 def parse(input, filename='') reset(input, filename) scan() rulesets = [] while @token == ?@ c = getch(); scan_ident() name = @value if name == 'import' imported_rulesets = parse_import_command() rulesets += imported_rulesets else raise parse_error("@#{name}: unsupported command.") end end while @token == ?# scan_ident() name = @value if name == 'DOCUMENT' rulesets << parse_document_ruleset() else rulesets += parse_element_ruleset() end end unless @token == nil raise parse_error("'#{@value}': '#name' is expected.") end return rulesets end |