Child pages
  • RuleAttribute

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Code Block
syntax RuleAttribute
{
  | Start                  = AttributeName="StartRule"
  | SpanClass              = AttributeName="SpanClass" "(" Class=Identifier ")"
  | ExplicitSpaces         = AttributeName="ExplicitSpaces"
  | ImplicitSpaces         = AttributeName="ImplicitSpaces"
  | SuppressTrailingSpaces = AttributeName="SuppressTrailingSpaces"
  | AllowTrailingSpaces    = AttributeName="AllowTrailingSpaces"
  | NoAst                  = AttributeName="NoAst"
  | KeyToken               = AttributeName="Key"
}

Attributes of the rules.

  • StartRule – tells the Nitra compiler to create a static method that simplifies the parsing starting from the rule marked by this attribute.
  • SpanClass – marks the rule with SpanClass which specifies the highlighting class. SpanClass should be declared in advance with the SpanClass directive.
  • ExplicitSpaces – suppresses whitespace rules auto placement and lets you specify them explicitly.
  • ImplicitSpaces – opposite of  ExplicitSpaces.
  • SuppressTrailingSpaces – suppresses a space followed by the rule marked with this attribute.
  • AllowTrailingSpaces – opposite of SuppressTrailingSpaces.
  • NoAst – suppresses AST creation for the rule marked with this attribute.
  • Key – lets you specify TokenRule and ExtensibleTokenRule as the rules that determine syntax structure. That impacts error recovery, making the parser create a "broken down" AST if keywords from the recovered rule have been encountered.