1 1. Introduction to rules-ng-ng text format
3 This-specification defines a text format that can be converted to and from rules-ng-ng XML.
4 It is intended to allow to create rules-ng-ng files with much less typing and with a more readable text.
5 xml2text can convert rules-ng-ng XML to this text format
6 text2xml can convert this text format to rules-ng-ng XML
8 This specification is an addendum to the rules-ng-ng specification and assumes familiarity with it.
14 The initial indentation of a line is divided by 8 and the result determines the position in the document structure (similar to the Python language).
15 A "//" anywhere in the line causes the rest to be converted to an XML comment (like C++)
16 A line starting with ":" creates a <doc> tag with the rest of the line (excluding anything starting with //).
17 The content of multiple lines starting with ":" is merged in a single <doc> tag.
21 The line is then tokenized.
22 Token are generally continuous strings on non-whitespace characters, with some exceptions
23 Some characters (such as ":", "=" and "-") form a single-character token.
24 Text within double quotes generates a <brief> tag.
25 Any token formatted as ATTR(VALUE) generates an ATTR="VALUE" attribute. No whitespace allowed between ATTR and the '(' character.
26 Any token formatted as (VALUE) generates a variants="VALUE" attribute.
27 Any token formatted as (VARSET=VALUE) generates a varset="VARSET" variants="VALUE" attribute.
29 2.3. Special token sequences
31 These sequences are recognized and extracted before matching the line format:
35 you must specify a type if the reg is anonymous
36 the : is recognized only if it is the third or successive token (and not the last) to avoid ambiguity with bitfields and generic tags
39 stride="STRIDE" attribute
42 length="LENGTH" attribute
46 no whitespace allowed after '!'
49 at the end of the line
50 set REGLIKE to "stripe"
53 at the end of the line
54 set REGLIKE to "array"
57 at the beginning of the line
58 inline="yes" attribute
62 The following line patterns are understood.
63 Only word tokens are used to match lines.
64 All tokens with special meaning are treated separately as described above.
65 [FOO] means that FOO is optional
71 REGLIKE is now set by default to regNUM instead of reg32
75 use this if there are no children
79 use this if there are children
82 <value value="TOKEN" /> if inside a reg or enum and TOKEN starts with a digit
83 <value name="TOKEN" /> if inside a reg or enum and TOKEN does not start with a digit
84 <REGLIKE offset="TOKEN" /> otherwise
87 <bitfield low="POS" high="POS" name="NAME"/> if inside a reg or bitset
88 <REGLIKE offset="POS" name="NAME"> otherwise
90 LOW - HIGH NAME [TYPE]
91 <bitfield low="LOW" high="HIGH" name="NAME" type="TYPE"/>
94 <value value="VALUE" name="NAME"/>
97 <use-WHAT name="NAME" />
100 <REGLIKE offset="OFFSET" name="NAME" type="TYPE">