Skip to content

Commit e7d5f5b

Browse files
committed
Minor clarifications in grammar and docs.
Signed-off-by: Łukasz Dywicki <luke@code-house.org>
1 parent b0868f0 commit e7d5f5b

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

bundles/org.connectorio.bittpl/README.adoc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff 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.
3739
What is notable - writing does not have to follow variable parts.
3840

3941
=== Example templates

bundles/org.connectorio.bittpl/src/main/antlr4/org/connectorio/bittpl/parser/BitTPL.g4

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
*/
1818
grammar 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

2223
segments
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 : '.';
4345
BIT
4446
: '0'
4547
| '1'
4648
;
4749

48-
HEX_SQ : HEX_DIGIT | '*';
50+
HEX_SEQ : HEX_DIGIT | HEX_ANY;
51+
HEX_ANY : '*';
4952
HEX_DIGIT
5053
: '0' .. '9'
5154
| 'a' .. 'f'

0 commit comments

Comments
 (0)