File tree Expand file tree Collapse file tree 2 files changed +17
-12
lines changed
bundles/org.connectorio.bittpl
src/main/antlr4/org/connectorio/bittpl/parser Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -8,32 +8,34 @@ Templates can be constructed from four elements described in table below.
88
99[cols="1,2,1,1"]
1010|===
11- |Name | Pattern| Size (bit count)| Notes
11+ |Name | Pattern| Size (bit count)| Sample expr.
1212
1313| Nibble
1414| `'0' .. '9' \| 'a' .. 'f' \| 'A' .. 'F'`
1515| 4
16- |
16+ | `xAA`
1717
1818| Nibble variable
1919| `*`
2020| 4
21- | Written as `0000b `
21+ | `xA* `
2222
2323| Bit
2424| `'0' .. '9' \| 'a' .. 'f' \| 'A' .. 'F'`
2525| 1
26- |
26+ | `b0010`
2727
2828| Bit variable
2929| `.`
3030| 1
31- | Written as `0b`.
31+ | `b1.0.`
3232
3333|===
3434
35- When template is turned again into message its variable part always default to `0b`.
36- It is duty of caller to fill placeholders with proper values.
35+ The template can be also used to create messages.
36+
37+ When template is turned into message, variable part is defaulted to `0x00`.
38+ Caller have to fill placeholders with proper values.
3739What is notable - writing does not have to follow variable parts.
3840
3941=== Example templates
Original file line number Diff line number Diff line change 1717 */
1818grammar BitTPL;
1919
20- // This grammar is a basic definition of permitted inputs for bit templates
20+ // This grammar is a basic definition of permitted inputs for byte based messages.
21+ // It allows to define a selective templates and matching patterns.
2122
2223segments
2324 : segment* EOF
@@ -36,16 +37,18 @@ octet
3637 ;
3738
3839
39- hexSeq : HEX_SQ +;
40- bitSeq : BIT_SQ +;
40+ hexSeq : HEX_SEQ +;
41+ bitSeq : BIT_SEQ +;
4142
42- BIT_SQ : BIT | ' .' ;
43+ BIT_SEQ : BIT | BIT_ANY ;
44+ BIT_ANY : ' .' ;
4345BIT
4446 : ' 0'
4547 | ' 1'
4648 ;
4749
48- HEX_SQ : HEX_DIGIT | ' *' ;
50+ HEX_SEQ : HEX_DIGIT | HEX_ANY ;
51+ HEX_ANY : ' *' ;
4952HEX_DIGIT
5053 : ' 0' .. ' 9'
5154 | ' a' .. ' f'
You can’t perform that action at this time.
0 commit comments