My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Compose Grammar (X.org)
// Written by Simos Xenitellis <simos.lists@googlemail.com>, 2008.
// Version 0.1

grammar Compose;

options
{
language = Python;
output = AST;
}

tokens
{
COMPOSE;
CODEPOINT;
SEQUENCE;
SYM;
}

compose
: sequence+ EOF
-> ^(COMPOSE sequence+)
;

sequence
: sym+ ':' DQSTRING NAME?
-> ^(SEQUENCE sym+ ^(CODEPOINT DQSTRING NAME?))
;

sym
: '<' NAME '>'
-> ^(SYM NAME)
;

NAME
: ( 'a'..'z' | 'A'..'Z' | '_' | '0'..'9' )*
;

WS
:
( ' ' | '\r' | '\t' | '\u000C' | '\n')
{ $channel=HIDDEN; }
;

LINE_COMMENT
:
'#' ~('\n' | '\r')* '\r'? '\n'
{ $channel=HIDDEN; }
;

/** Match various string types. Note that greedy=false implies '''
* should make us exit loop not continue.
*/
DQSTRING
: '"' str=('\\\"' | (options {greedy=false;}:~('"'))*) '"'
;

Change log

r34 by simos.lists on Jun 8, 2008   Diff
Initial import of Compose grammar
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 834 bytes, 58 lines
Powered by Google Project Hosting