parse-rule-tag ( rule-set tag -- )


Vocabulary
xmode.loader

Inputs
rule-setan object
tagan object


Outputs
None

Definition


: parse-rule-tag ( rule-set tag -- )
dup main>> {
{
"TERMINATE"
[
"AT_CHAR" attr string>number >>terminate-char
drop
]
}
{
"SEQ"
[
{
{ "TYPE" string>token body-token<< }
{ "DELEGATE" f delegate<< }
[ parse-literal-matcher >>start drop ]
}
\ seq-rule
(parse-rule-tag)
]
}
{
"SEQ_REGEXP"
[
{
{ "TYPE" string>token body-token<< }
{ "DELEGATE" f delegate<< }
{ "HASH_CHARS" f chars<< }
{ "HASH_CHAR" f char<< }
[ parse-regexp-matcher >>start drop ]
}
\ seq-rule
(parse-rule-tag)
]
}
{
"EOL_SPAN_REGEXP"
[
{
{ "TYPE" string>token body-token<< }
{ "DELEGATE" f delegate<< }
{
"MATCH_TYPE"
string>match-type
match-token<<
}
{ "HASH_CHARS" f chars<< }
{ "HASH_CHAR" f char<< }
[ parse-regexp-matcher >>start drop ]
[ drop init-eol-span ]
}
\ eol-span-rule
(parse-rule-tag)
]
}
{
"EOL_SPAN"
[
{
{ "TYPE" string>token body-token<< }
{ "DELEGATE" f delegate<< }
{
"MATCH_TYPE"
string>match-type
match-token<<
}
[ parse-literal-matcher >>start drop ]
[ drop init-eol-span ]
}
\ eol-span-rule
(parse-rule-tag)
]
}
{
"MARK_PREVIOUS"
[
{
{ "TYPE" string>token body-token<< }
{
"MATCH_TYPE"
string>match-type
match-token<<
}
[ parse-literal-matcher >>start drop ]
}
\ mark-previous-rule
(parse-rule-tag)
]
}
{
"SPAN_REGEXP"
[
{
{ "TYPE" string>token body-token<< }
{ "DELEGATE" f delegate<< }
{
"MATCH_TYPE"
string>match-type
match-token<<
}
{
"NO_LINE_BREAK"
string>boolean
no-line-break?<<
}
{
"NO_WORD_BREAK"
string>boolean
no-word-break?<<
}
{ "ESCAPE" string>escape escape-rule<< }
{ "HASH_CHARS" f chars<< }
{ "HASH_CHAR" f char<< }
[ children-tags ~quotation~ with each ]
[ drop init-span ]
}
\ span-rule
(parse-rule-tag)
]
}
{ "IMPORT" [ "DELEGATE" attr swap import-rule-set ] }
{
"SPAN"
[
{
{ "TYPE" string>token body-token<< }
{ "DELEGATE" f delegate<< }
{
"MATCH_TYPE"
string>match-type
match-token<<
}
{
"NO_LINE_BREAK"
string>boolean
no-line-break?<<
}
{
"NO_WORD_BREAK"
string>boolean
no-word-break?<<
}
{ "ESCAPE" string>escape escape-rule<< }
[ children-tags ~quotation~ with each ]
[ drop init-span ]
}
\ span-rule
(parse-rule-tag)
]
}
{
"MARK_FOLLOWING"
[
{
{ "TYPE" string>token body-token<< }
{
"MATCH_TYPE"
string>match-type
match-token<<
}
[ parse-literal-matcher >>start drop ]
}
\ mark-following-rule
(parse-rule-tag)
]
}
{ "PROPS" [ parse-props-tag >>props drop ] }
{
"KEYWORDS"
[
rule-set get ignore-case?>> <keyword-map> swap
children-tags [ over parse-keyword-tag ] each
swap keywords<<
]
}
[ \ parse-rule-tag no-tag ]
} case ;