-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathQLS.rsc
114 lines (89 loc) · 3.12 KB
/
QLS.rsc
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
@license{
Copyright (c) 2013
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
}
@contributor{Kevin van der Vlist - kevin@kevinvandervlist.nl}
@contributor{Jimi van der Woning - Jimi.vanderWoning@student.uva.nl}
module lang::qls::\syntax::QLS
extend lang::ql::\syntax::Comment;
extend lang::ql::\syntax::Int;
extend lang::ql::\syntax::Layout;
extend lang::ql::\syntax::Money;
extend lang::ql::\syntax::String;
extend lang::ql::\syntax::Type;
extend lang::qls::\syntax::Color;
extend lang::qls::\syntax::Keyword;
start syntax Stylesheet
= stylesheet: "stylesheet" Ident "{" Definition* definitions "}";
syntax Definition
= @Foldable PageDefinition
| @Foldable SectionDefinition
| @Foldable QuestionDefinition
| @Foldable DefaultDefinition
;
syntax PageDefinition = pageDefinition: "page" String "{" LayoutRule* "}";
syntax SectionDefinition
= sectionDefinition: "section" String "{" LayoutRule* "}";
syntax LayoutRule
= @Foldable layoutRule: SectionDefinition
| @Foldable layoutRule: QuestionDefinition
| @Foldable layoutRule: DefaultDefinition
;
syntax QuestionDefinition
= questionDefinition: "question" Ident
| questionDefinition: "question" Ident "{" StyleRule* "}"
;
syntax DefaultDefinition = defaultDefinition: "default" Type "{" StyleRule* "}";
syntax StyleRule
= widgetStyleRule: WidgetStyleAttr WidgetStyleValue
| intStyleRule: IntStyleAttr Int
| stringStyleRule: StringStyleAttr String
| colorStyleRule: ColorStyleAttr Color
;
syntax WidgetStyleValue
= text: TextWidgetValue
| number: NumberWidgetValue
| number: NumberWidgetValue "[" Number "," Number "]"
| number: NumberWidgetValue "[" Number "," Number "," Number "]"
| datepicker: DatepickerWidgetValue
| slider: SliderWidgetValue
| slider: SliderWidgetValue "[" Number "," Number "]"
| slider: SliderWidgetValue "[" Number "," Number "," Number "]"
| radio: RadioWidgetValue
| checkbox: CheckboxWidgetValue
| select: SelectWidgetValue
;
lexical Number
= Int
| Money
;
lexical TextWidgetValue = "text";
lexical NumberWidgetValue = "number";
lexical DatepickerWidgetValue = "datepicker";
lexical SliderWidgetValue = "slider";
lexical RadioWidgetValue = "radio";
lexical CheckboxWidgetValue = "checkbox";
lexical SelectWidgetValue = "select";
lexical WidgetStyleAttr = @category="Identifier" widget: "widget";
lexical IntStyleAttr
= @category="Identifier" width: "width"
| @category="Identifier" fontsize: "fontsize"
| @category="Identifier" labelFontsize: "label-fontsize"
;
lexical StringStyleAttr
= @category="Identifier" font: "font"
| @category="Identifier" labelFont: "label-font"
;
lexical ColorStyleAttr
= @category="Identifier" color: "color"
| @category="Identifier" labelColor: "label-color"
;
syntax Ident
= @category="Variable" ident: IdentLexical \ Keywords
| @category="Variable" ident: "\\" IdentLexical
;
lexical IdentLexical
= [a-z A-Z 0-9 _] !<< [a-z A-Z][a-z A-Z 0-9 _]* !>> [a-z A-Z 0-9 _];