this repo has no description
1from pygments.lexer import RegexLexer, bygroups, words, include, inherit
2from pygments.token import *
3
4import re
5
6__all__=['MznLexer']
7
8class MznLexer(RegexLexer):
9 name = 'Mzn'
10 aliases = ['mzn']
11 filenames = ['*.mzn', '*.fzn', '*.dzn']
12 flags = re.MULTILINE | re.UNICODE
13
14 tokens = {
15 'root' : [
16 (u'(/\\*)', bygroups(Comment), 'multi_line_comment__1'),
17 (u'(%.*)', bygroups(Comment)),
18 (u'(@.*@)', bygroups(Text)),
19 (u'(\\b0o[0-7]+)', bygroups(Number)),
20 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
21 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
22 (u'(\\b\\d+(?:(?:.\\d+)?[Ee][-+]?\\d+|.\\d+))', bygroups(Number)),
23 (u'(\\b\\d+)', bygroups(Number)),
24 (u'(\\\")', bygroups(String), 'string__1'),
25 (u'(\\b(?:true|false)\\b)', bygroups(Literal)),
26 (u'(\\bnot\\b|<->|->|<-|\\\\/|\\bxor\\b|/\\\\)', bygroups(Operator)),
27 (u'(<|>|<=|>=|==|=|!=)', bygroups(Operator)),
28 (u'(\\+|-|\\*|/|\\bdiv\\b|\\bmod\\b)', bygroups(Operator)),
29 (u'(\\b(?:subset|superset|union|diff|symdiff|intersect|\\.\\.)\\b)', bygroups(Operator)),
30 (u'(;)', bygroups(Punctuation)),
31 (u'(:)', bygroups(Punctuation)),
32 (u'(,)', bygroups(Punctuation)),
33 (u'(\\{)', bygroups(Punctuation), 'main__1'),
34 (u'(\\[)', bygroups(Punctuation), 'main__2'),
35 (u'(\\()', bygroups(Punctuation), 'main__3'),
36 (u'(\\}|\\]|\\))', bygroups(Generic.Error)),
37 (u'(\\|)', bygroups(Generic.Error)),
38 (u'(\\b(?:annotation|constraint|function|include|op|output|minimize|maximize|predicate|satisfy|solve|test|type)\\b)', bygroups(Keyword)),
39 (u'(\\b(?:ann|array|bool|enum|float|int|list|of|par|set|string|tuple|var)\\b)', bygroups(Keyword.Type)),
40 (u'(\\b(?:for|forall|if|then|elseif|else|endif|where|let|in)\\b)', bygroups(Keyword)),
41 (u'(\\b(?:any|case|op|record)\\b)', bygroups(Generic.Error)),
42 (u'(\\b(?:abort|abs|acosh|array_intersect|array_union|array1d|array2d|array3d|array4d|array5d|array6d|asin|assert|atan|bool2int|card|ceil|concat|cos|cosh|dom|dom_array|dom_size|fix|exp|floor|index_set|index_set_1of2|index_set_2of2|index_set_1of3|index_set_2of3|index_set_3of3|int2float|is_fixed|join|lb|lb_array|length|ln|log|log2|log10|min|max|pow|product|round|set2array|show|show_int|show_float|sin|sinh|sqrt|sum|tan|tanh|trace|ub|ub_array)\\b)', bygroups(Name.Builtin)),
43 (u'(\\b(?:circuit|disjoint|maximum|maximum_arg|member|minimum|minimum_arg|network_flow|network_flow_cost|partition_set|range|roots|sliding_sum|subcircuit|sum_pred)\\b)', bygroups(Name.Builtin.Pseudo)),
44 (u'(\\b(?:alldifferent|all_different|all_disjoint|all_equal|alldifferent_except_0|nvalue|symmetric_all_different)\\b)', bygroups(Name.Builtin.Pseudo)),
45 (u'(\\b(?:lex2|lex_greater|lex_greatereq|lex_less|lex_lesseq|strict_lex2|value_precede|value_precede_chain)\\b)', bygroups(Name.Builtin.Pseudo)),
46 (u'(\\b(?:arg_sort|decreasing|increasing|sort)\\b)', bygroups(Name.Builtin.Pseudo)),
47 (u'(\\b(?:int_set_channel|inverse|inverse_set|link_set_to_booleans)\\b)', bygroups(Name.Builtin.Pseudo)),
48 (u'(\\b(?:among|at_least|at_most|at_most1|count|count_eq|count_geq|count_gt|count_leq|count_lt|count_neq|distribute|exactly|global_cardinality|global_cardinality_closed|global_cardinality_low_up|global_cardinality_low_up_closed)\\b)', bygroups(Name.Builtin.Pseudo)),
49 (u'(\\b(?:bin_packing|bin_packing_capa|bin_packing_load|diffn|diffn_k|diffn_nonstrict|diffn_nonstrict_k|geost|geost_bb|geost_smallest_bb|knapsack)\\b)', bygroups(Name.Builtin.Pseudo)),
50 (u'(\\b(?:alternative|cumulative|disjunctive|disjunctive_strict|span)\\b)', bygroups(Name.Builtin.Pseudo)),
51 (u'(\\b(?:regular|regular_nfa|table)\\b)', bygroups(Name.Builtin.Pseudo)),
52 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')(\\()', bygroups(Name.Function, Punctuation), 'main__4'),
53 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')', bygroups(Name.Variable)),
54 ('(\n|\r|\r\n)', String),
55 ('.', String),
56 ],
57 'main__1' : [
58 (u'(\\})', bygroups(Punctuation), '#pop'),
59 (u'(\\|)', bygroups(Punctuation)),
60 (u'(/\\*)', bygroups(Comment), 'multi_line_comment__1'),
61 (u'(%.*)', bygroups(Comment)),
62 (u'(\\b0o[0-7]+)', bygroups(Number)),
63 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
64 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
65 (u'(\\b\\d+(?:(?:.\\d+)?[Ee][-+]?\\d+|.\\d+))', bygroups(Number)),
66 (u'(\\b\\d+)', bygroups(Number)),
67 (u'(\\\")', bygroups(String), 'string__1'),
68 (u'(\\b(?:true|false)\\b)', bygroups(Literal)),
69 (u'(\\bnot\\b|<->|->|<-|\\\\/|\\bxor\\b|/\\\\)', bygroups(Operator)),
70 (u'(<|>|<=|>=|==|=|!=)', bygroups(Operator)),
71 (u'(\\+|-|\\*|/|\\bdiv\\b|\\bmod\\b)', bygroups(Operator)),
72 (u'(\\b(?:subset|superset|union|diff|symdiff|intersect|\\.\\.)\\b)', bygroups(Operator)),
73 (u'(;)', bygroups(Punctuation)),
74 (u'(:)', bygroups(Punctuation)),
75 (u'(,)', bygroups(Punctuation)),
76 (u'(\\{)', bygroups(Punctuation), 'main__1'),
77 (u'(\\[)', bygroups(Punctuation), 'main__2'),
78 (u'(\\()', bygroups(Punctuation), 'main__3'),
79 (u'(\\}|\\]|\\))', bygroups(Generic.Error)),
80 (u'(\\|)', bygroups(Generic.Error)),
81 (u'(\\b(?:annotation|constraint|function|include|op|output|minimize|maximize|predicate|satisfy|solve|test|type)\\b)', bygroups(Keyword)),
82 (u'(\\b(?:ann|array|bool|enum|float|int|list|of|par|set|string|tuple|var)\\b)', bygroups(Keyword.Type)),
83 (u'(\\b(?:for|forall|if|then|elseif|else|endif|where|let|in)\\b)', bygroups(Keyword)),
84 (u'(\\b(?:any|case|op|record)\\b)', bygroups(Generic.Error)),
85 (u'(\\b(?:abort|abs|acosh|array_intersect|array_union|array1d|array2d|array3d|array4d|array5d|array6d|asin|assert|atan|bool2int|card|ceil|concat|cos|cosh|dom|dom_array|dom_size|fix|exp|floor|index_set|index_set_1of2|index_set_2of2|index_set_1of3|index_set_2of3|index_set_3of3|int2float|is_fixed|join|lb|lb_array|length|ln|log|log2|log10|min|max|pow|product|round|set2array|show|show_int|show_float|sin|sinh|sqrt|sum|tan|tanh|trace|ub|ub_array)\\b)', bygroups(Name.Builtin)),
86 (u'(\\b(?:circuit|disjoint|maximum|maximum_arg|member|minimum|minimum_arg|network_flow|network_flow_cost|partition_set|range|roots|sliding_sum|subcircuit|sum_pred)\\b)', bygroups(Name.Builtin.Pseudo)),
87 (u'(\\b(?:alldifferent|all_different|all_disjoint|all_equal|alldifferent_except_0|nvalue|symmetric_all_different)\\b)', bygroups(Name.Builtin.Pseudo)),
88 (u'(\\b(?:lex2|lex_greater|lex_greatereq|lex_less|lex_lesseq|strict_lex2|value_precede|value_precede_chain)\\b)', bygroups(Name.Builtin.Pseudo)),
89 (u'(\\b(?:arg_sort|decreasing|increasing|sort)\\b)', bygroups(Name.Builtin.Pseudo)),
90 (u'(\\b(?:int_set_channel|inverse|inverse_set|link_set_to_booleans)\\b)', bygroups(Name.Builtin.Pseudo)),
91 (u'(\\b(?:among|at_least|at_most|at_most1|count|count_eq|count_geq|count_gt|count_leq|count_lt|count_neq|distribute|exactly|global_cardinality|global_cardinality_closed|global_cardinality_low_up|global_cardinality_low_up_closed)\\b)', bygroups(Name.Builtin.Pseudo)),
92 (u'(\\b(?:bin_packing|bin_packing_capa|bin_packing_load|diffn|diffn_k|diffn_nonstrict|diffn_nonstrict_k|geost|geost_bb|geost_smallest_bb|knapsack)\\b)', bygroups(Name.Builtin.Pseudo)),
93 (u'(\\b(?:alternative|cumulative|disjunctive|disjunctive_strict|span)\\b)', bygroups(Name.Builtin.Pseudo)),
94 (u'(\\b(?:regular|regular_nfa|table)\\b)', bygroups(Name.Builtin.Pseudo)),
95 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')(\\()', bygroups(Name.Function, Punctuation), 'main__4'),
96 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')', bygroups(Name.Variable)),
97 ('(\n|\r|\r\n)', String),
98 ('.', String),
99 ],
100 'main__2' : [
101 (u'(\\])', bygroups(Punctuation), '#pop'),
102 (u'(\\|)', bygroups(Punctuation)),
103 (u'(/\\*)', bygroups(Comment), 'multi_line_comment__1'),
104 (u'(%.*)', bygroups(Comment)),
105 (u'(\\b0o[0-7]+)', bygroups(Number)),
106 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
107 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
108 (u'(\\b\\d+(?:(?:.\\d+)?[Ee][-+]?\\d+|.\\d+))', bygroups(Number)),
109 (u'(\\b\\d+)', bygroups(Number)),
110 (u'(\\\")', bygroups(String), 'string__1'),
111 (u'(\\b(?:true|false)\\b)', bygroups(Literal)),
112 (u'(\\bnot\\b|<->|->|<-|\\\\/|\\bxor\\b|/\\\\)', bygroups(Operator)),
113 (u'(<|>|<=|>=|==|=|!=)', bygroups(Operator)),
114 (u'(\\+|-|\\*|/|\\bdiv\\b|\\bmod\\b)', bygroups(Operator)),
115 (u'(\\b(?:subset|superset|union|diff|symdiff|intersect|\\.\\.)\\b)', bygroups(Operator)),
116 (u'(;)', bygroups(Punctuation)),
117 (u'(:)', bygroups(Punctuation)),
118 (u'(,)', bygroups(Punctuation)),
119 (u'(\\{)', bygroups(Punctuation), 'main__1'),
120 (u'(\\[)', bygroups(Punctuation), 'main__2'),
121 (u'(\\()', bygroups(Punctuation), 'main__3'),
122 (u'(\\}|\\]|\\))', bygroups(Generic.Error)),
123 (u'(\\|)', bygroups(Generic.Error)),
124 (u'(\\b(?:annotation|constraint|function|include|op|output|minimize|maximize|predicate|satisfy|solve|test|type)\\b)', bygroups(Keyword)),
125 (u'(\\b(?:ann|array|bool|enum|float|int|list|of|par|set|string|tuple|var)\\b)', bygroups(Keyword.Type)),
126 (u'(\\b(?:for|forall|if|then|elseif|else|endif|where|let|in)\\b)', bygroups(Keyword)),
127 (u'(\\b(?:any|case|op|record)\\b)', bygroups(Generic.Error)),
128 (u'(\\b(?:abort|abs|acosh|array_intersect|array_union|array1d|array2d|array3d|array4d|array5d|array6d|asin|assert|atan|bool2int|card|ceil|concat|cos|cosh|dom|dom_array|dom_size|fix|exp|floor|index_set|index_set_1of2|index_set_2of2|index_set_1of3|index_set_2of3|index_set_3of3|int2float|is_fixed|join|lb|lb_array|length|ln|log|log2|log10|min|max|pow|product|round|set2array|show|show_int|show_float|sin|sinh|sqrt|sum|tan|tanh|trace|ub|ub_array)\\b)', bygroups(Name.Builtin)),
129 (u'(\\b(?:circuit|disjoint|maximum|maximum_arg|member|minimum|minimum_arg|network_flow|network_flow_cost|partition_set|range|roots|sliding_sum|subcircuit|sum_pred)\\b)', bygroups(Name.Builtin.Pseudo)),
130 (u'(\\b(?:alldifferent|all_different|all_disjoint|all_equal|alldifferent_except_0|nvalue|symmetric_all_different)\\b)', bygroups(Name.Builtin.Pseudo)),
131 (u'(\\b(?:lex2|lex_greater|lex_greatereq|lex_less|lex_lesseq|strict_lex2|value_precede|value_precede_chain)\\b)', bygroups(Name.Builtin.Pseudo)),
132 (u'(\\b(?:arg_sort|decreasing|increasing|sort)\\b)', bygroups(Name.Builtin.Pseudo)),
133 (u'(\\b(?:int_set_channel|inverse|inverse_set|link_set_to_booleans)\\b)', bygroups(Name.Builtin.Pseudo)),
134 (u'(\\b(?:among|at_least|at_most|at_most1|count|count_eq|count_geq|count_gt|count_leq|count_lt|count_neq|distribute|exactly|global_cardinality|global_cardinality_closed|global_cardinality_low_up|global_cardinality_low_up_closed)\\b)', bygroups(Name.Builtin.Pseudo)),
135 (u'(\\b(?:bin_packing|bin_packing_capa|bin_packing_load|diffn|diffn_k|diffn_nonstrict|diffn_nonstrict_k|geost|geost_bb|geost_smallest_bb|knapsack)\\b)', bygroups(Name.Builtin.Pseudo)),
136 (u'(\\b(?:alternative|cumulative|disjunctive|disjunctive_strict|span)\\b)', bygroups(Name.Builtin.Pseudo)),
137 (u'(\\b(?:regular|regular_nfa|table)\\b)', bygroups(Name.Builtin.Pseudo)),
138 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')(\\()', bygroups(Name.Function, Punctuation), 'main__4'),
139 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')', bygroups(Name.Variable)),
140 ('(\n|\r|\r\n)', String),
141 ('.', String),
142 ],
143 'main__3' : [
144 (u'(\\))', bygroups(Punctuation), '#pop'),
145 (u'(/\\*)', bygroups(Comment), 'multi_line_comment__1'),
146 (u'(%.*)', bygroups(Comment)),
147 (u'(\\b0o[0-7]+)', bygroups(Number)),
148 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
149 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
150 (u'(\\b\\d+(?:(?:.\\d+)?[Ee][-+]?\\d+|.\\d+))', bygroups(Number)),
151 (u'(\\b\\d+)', bygroups(Number)),
152 (u'(\\\")', bygroups(String), 'string__1'),
153 (u'(\\b(?:true|false)\\b)', bygroups(Literal)),
154 (u'(\\bnot\\b|<->|->|<-|\\\\/|\\bxor\\b|/\\\\)', bygroups(Operator)),
155 (u'(<|>|<=|>=|==|=|!=)', bygroups(Operator)),
156 (u'(\\+|-|\\*|/|\\bdiv\\b|\\bmod\\b)', bygroups(Operator)),
157 (u'(\\b(?:subset|superset|union|diff|symdiff|intersect|\\.\\.)\\b)', bygroups(Operator)),
158 (u'(;)', bygroups(Punctuation)),
159 (u'(:)', bygroups(Punctuation)),
160 (u'(,)', bygroups(Punctuation)),
161 (u'(\\{)', bygroups(Punctuation), 'main__1'),
162 (u'(\\[)', bygroups(Punctuation), 'main__2'),
163 (u'(\\()', bygroups(Punctuation), 'main__3'),
164 (u'(\\}|\\]|\\))', bygroups(Generic.Error)),
165 (u'(\\|)', bygroups(Generic.Error)),
166 (u'(\\b(?:annotation|constraint|function|include|op|output|minimize|maximize|predicate|satisfy|solve|test|type)\\b)', bygroups(Keyword)),
167 (u'(\\b(?:ann|array|bool|enum|float|int|list|of|par|set|string|tuple|var)\\b)', bygroups(Keyword.Type)),
168 (u'(\\b(?:for|forall|if|then|elseif|else|endif|where|let|in)\\b)', bygroups(Keyword)),
169 (u'(\\b(?:any|case|op|record)\\b)', bygroups(Generic.Error)),
170 (u'(\\b(?:abort|abs|acosh|array_intersect|array_union|array1d|array2d|array3d|array4d|array5d|array6d|asin|assert|atan|bool2int|card|ceil|concat|cos|cosh|dom|dom_array|dom_size|fix|exp|floor|index_set|index_set_1of2|index_set_2of2|index_set_1of3|index_set_2of3|index_set_3of3|int2float|is_fixed|join|lb|lb_array|length|ln|log|log2|log10|min|max|pow|product|round|set2array|show|show_int|show_float|sin|sinh|sqrt|sum|tan|tanh|trace|ub|ub_array)\\b)', bygroups(Name.Builtin)),
171 (u'(\\b(?:circuit|disjoint|maximum|maximum_arg|member|minimum|minimum_arg|network_flow|network_flow_cost|partition_set|range|roots|sliding_sum|subcircuit|sum_pred)\\b)', bygroups(Name.Builtin.Pseudo)),
172 (u'(\\b(?:alldifferent|all_different|all_disjoint|all_equal|alldifferent_except_0|nvalue|symmetric_all_different)\\b)', bygroups(Name.Builtin.Pseudo)),
173 (u'(\\b(?:lex2|lex_greater|lex_greatereq|lex_less|lex_lesseq|strict_lex2|value_precede|value_precede_chain)\\b)', bygroups(Name.Builtin.Pseudo)),
174 (u'(\\b(?:arg_sort|decreasing|increasing|sort)\\b)', bygroups(Name.Builtin.Pseudo)),
175 (u'(\\b(?:int_set_channel|inverse|inverse_set|link_set_to_booleans)\\b)', bygroups(Name.Builtin.Pseudo)),
176 (u'(\\b(?:among|at_least|at_most|at_most1|count|count_eq|count_geq|count_gt|count_leq|count_lt|count_neq|distribute|exactly|global_cardinality|global_cardinality_closed|global_cardinality_low_up|global_cardinality_low_up_closed)\\b)', bygroups(Name.Builtin.Pseudo)),
177 (u'(\\b(?:bin_packing|bin_packing_capa|bin_packing_load|diffn|diffn_k|diffn_nonstrict|diffn_nonstrict_k|geost|geost_bb|geost_smallest_bb|knapsack)\\b)', bygroups(Name.Builtin.Pseudo)),
178 (u'(\\b(?:alternative|cumulative|disjunctive|disjunctive_strict|span)\\b)', bygroups(Name.Builtin.Pseudo)),
179 (u'(\\b(?:regular|regular_nfa|table)\\b)', bygroups(Name.Builtin.Pseudo)),
180 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')(\\()', bygroups(Name.Function, Punctuation), 'main__4'),
181 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')', bygroups(Name.Variable)),
182 ('(\n|\r|\r\n)', String),
183 ('.', String),
184 ],
185 'main__4' : [
186 (u'(\\))', bygroups(Punctuation), '#pop'),
187 (u'(/\\*)', bygroups(Comment), 'multi_line_comment__1'),
188 (u'(%.*)', bygroups(Comment)),
189 (u'(\\b0o[0-7]+)', bygroups(Number)),
190 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
191 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
192 (u'(\\b\\d+(?:(?:.\\d+)?[Ee][-+]?\\d+|.\\d+))', bygroups(Number)),
193 (u'(\\b\\d+)', bygroups(Number)),
194 (u'(\\\")', bygroups(String), 'string__1'),
195 (u'(\\b(?:true|false)\\b)', bygroups(Literal)),
196 (u'(\\bnot\\b|<->|->|<-|\\\\/|\\bxor\\b|/\\\\)', bygroups(Operator)),
197 (u'(<|>|<=|>=|==|=|!=)', bygroups(Operator)),
198 (u'(\\+|-|\\*|/|\\bdiv\\b|\\bmod\\b)', bygroups(Operator)),
199 (u'(\\b(?:subset|superset|union|diff|symdiff|intersect|\\.\\.)\\b)', bygroups(Operator)),
200 (u'(;)', bygroups(Punctuation)),
201 (u'(:)', bygroups(Punctuation)),
202 (u'(,)', bygroups(Punctuation)),
203 (u'(\\{)', bygroups(Punctuation), 'main__1'),
204 (u'(\\[)', bygroups(Punctuation), 'main__2'),
205 (u'(\\()', bygroups(Punctuation), 'main__3'),
206 (u'(\\}|\\]|\\))', bygroups(Generic.Error)),
207 (u'(\\|)', bygroups(Generic.Error)),
208 (u'(\\b(?:annotation|constraint|function|include|op|output|minimize|maximize|predicate|satisfy|solve|test|type)\\b)', bygroups(Keyword)),
209 (u'(\\b(?:ann|array|bool|enum|float|int|list|of|par|set|string|tuple|var)\\b)', bygroups(Keyword.Type)),
210 (u'(\\b(?:for|forall|if|then|elseif|else|endif|where|let|in)\\b)', bygroups(Keyword)),
211 (u'(\\b(?:any|case|op|record)\\b)', bygroups(Generic.Error)),
212 (u'(\\b(?:abort|abs|acosh|array_intersect|array_union|array1d|array2d|array3d|array4d|array5d|array6d|asin|assert|atan|bool2int|card|ceil|concat|cos|cosh|dom|dom_array|dom_size|fix|exp|floor|index_set|index_set_1of2|index_set_2of2|index_set_1of3|index_set_2of3|index_set_3of3|int2float|is_fixed|join|lb|lb_array|length|ln|log|log2|log10|min|max|pow|product|round|set2array|show|show_int|show_float|sin|sinh|sqrt|sum|tan|tanh|trace|ub|ub_array)\\b)', bygroups(Name.Builtin)),
213 (u'(\\b(?:circuit|disjoint|maximum|maximum_arg|member|minimum|minimum_arg|network_flow|network_flow_cost|partition_set|range|roots|sliding_sum|subcircuit|sum_pred)\\b)', bygroups(Name.Builtin.Pseudo)),
214 (u'(\\b(?:alldifferent|all_different|all_disjoint|all_equal|alldifferent_except_0|nvalue|symmetric_all_different)\\b)', bygroups(Name.Builtin.Pseudo)),
215 (u'(\\b(?:lex2|lex_greater|lex_greatereq|lex_less|lex_lesseq|strict_lex2|value_precede|value_precede_chain)\\b)', bygroups(Name.Builtin.Pseudo)),
216 (u'(\\b(?:arg_sort|decreasing|increasing|sort)\\b)', bygroups(Name.Builtin.Pseudo)),
217 (u'(\\b(?:int_set_channel|inverse|inverse_set|link_set_to_booleans)\\b)', bygroups(Name.Builtin.Pseudo)),
218 (u'(\\b(?:among|at_least|at_most|at_most1|count|count_eq|count_geq|count_gt|count_leq|count_lt|count_neq|distribute|exactly|global_cardinality|global_cardinality_closed|global_cardinality_low_up|global_cardinality_low_up_closed)\\b)', bygroups(Name.Builtin.Pseudo)),
219 (u'(\\b(?:bin_packing|bin_packing_capa|bin_packing_load|diffn|diffn_k|diffn_nonstrict|diffn_nonstrict_k|geost|geost_bb|geost_smallest_bb|knapsack)\\b)', bygroups(Name.Builtin.Pseudo)),
220 (u'(\\b(?:alternative|cumulative|disjunctive|disjunctive_strict|span)\\b)', bygroups(Name.Builtin.Pseudo)),
221 (u'(\\b(?:regular|regular_nfa|table)\\b)', bygroups(Name.Builtin.Pseudo)),
222 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')(\\()', bygroups(Name.Function, Punctuation), 'main__4'),
223 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')', bygroups(Name.Variable)),
224 ('(\n|\r|\r\n)', String),
225 ('.', String),
226 ],
227 'multi_line_comment__1' : [
228 (u'(\\*/)', bygroups(Comment), '#pop'),
229 ('(\n|\r|\r\n)', String),
230 ('.', Comment),
231 ],
232 'string__1' : [
233 (u'(\\\")', bygroups(String), '#pop'),
234 (u'(\\\\\\()', bygroups(Punctuation), 'string__2'),
235 (u'(\\\\[\"\'\\\\nrvt])', bygroups(String.Escape)),
236 (u'([^\\\"\\\\\\n\\r]+)', bygroups(String)),
237 ('(\n|\r|\r\n)', String),
238 ('.', String),
239 ],
240 'string__2' : [
241 (u'(\\))', bygroups(Punctuation), '#pop'),
242 (u'(/\\*)', bygroups(Comment), 'multi_line_comment__1'),
243 (u'(%.*)', bygroups(Comment)),
244 (u'(\\b0o[0-7]+)', bygroups(Number)),
245 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
246 (u'(\\b0x[0-9A-Fa-f]+)', bygroups(Number)),
247 (u'(\\b\\d+(?:(?:.\\d+)?[Ee][-+]?\\d+|.\\d+))', bygroups(Number)),
248 (u'(\\b\\d+)', bygroups(Number)),
249 (u'(\\\")', bygroups(String), 'string__1'),
250 (u'(\\b(?:true|false)\\b)', bygroups(Literal)),
251 (u'(\\bnot\\b|<->|->|<-|\\\\/|\\bxor\\b|/\\\\)', bygroups(Operator)),
252 (u'(<|>|<=|>=|==|=|!=)', bygroups(Operator)),
253 (u'(\\+|-|\\*|/|\\bdiv\\b|\\bmod\\b)', bygroups(Operator)),
254 (u'(\\b(?:subset|superset|union|diff|symdiff|intersect|\\.\\.)\\b)', bygroups(Operator)),
255 (u'(;)', bygroups(Punctuation)),
256 (u'(:)', bygroups(Punctuation)),
257 (u'(,)', bygroups(Punctuation)),
258 (u'(\\{)', bygroups(Punctuation), 'main__1'),
259 (u'(\\[)', bygroups(Punctuation), 'main__2'),
260 (u'(\\()', bygroups(Punctuation), 'main__3'),
261 (u'(\\}|\\]|\\))', bygroups(Generic.Error)),
262 (u'(\\|)', bygroups(Generic.Error)),
263 (u'(\\b(?:annotation|constraint|function|include|op|output|minimize|maximize|predicate|satisfy|solve|test|type)\\b)', bygroups(Keyword)),
264 (u'(\\b(?:ann|array|bool|enum|float|int|list|of|par|set|string|tuple|var)\\b)', bygroups(Keyword.Type)),
265 (u'(\\b(?:for|forall|if|then|elseif|else|endif|where|let|in)\\b)', bygroups(Keyword)),
266 (u'(\\b(?:any|case|op|record)\\b)', bygroups(Generic.Error)),
267 (u'(\\b(?:abort|abs|acosh|array_intersect|array_union|array1d|array2d|array3d|array4d|array5d|array6d|asin|assert|atan|bool2int|card|ceil|concat|cos|cosh|dom|dom_array|dom_size|fix|exp|floor|index_set|index_set_1of2|index_set_2of2|index_set_1of3|index_set_2of3|index_set_3of3|int2float|is_fixed|join|lb|lb_array|length|ln|log|log2|log10|min|max|pow|product|round|set2array|show|show_int|show_float|sin|sinh|sqrt|sum|tan|tanh|trace|ub|ub_array)\\b)', bygroups(Name.Builtin)),
268 (u'(\\b(?:circuit|disjoint|maximum|maximum_arg|member|minimum|minimum_arg|network_flow|network_flow_cost|partition_set|range|roots|sliding_sum|subcircuit|sum_pred)\\b)', bygroups(Name.Builtin.Pseudo)),
269 (u'(\\b(?:alldifferent|all_different|all_disjoint|all_equal|alldifferent_except_0|nvalue|symmetric_all_different)\\b)', bygroups(Name.Builtin.Pseudo)),
270 (u'(\\b(?:lex2|lex_greater|lex_greatereq|lex_less|lex_lesseq|strict_lex2|value_precede|value_precede_chain)\\b)', bygroups(Name.Builtin.Pseudo)),
271 (u'(\\b(?:arg_sort|decreasing|increasing|sort)\\b)', bygroups(Name.Builtin.Pseudo)),
272 (u'(\\b(?:int_set_channel|inverse|inverse_set|link_set_to_booleans)\\b)', bygroups(Name.Builtin.Pseudo)),
273 (u'(\\b(?:among|at_least|at_most|at_most1|count|count_eq|count_geq|count_gt|count_leq|count_lt|count_neq|distribute|exactly|global_cardinality|global_cardinality_closed|global_cardinality_low_up|global_cardinality_low_up_closed)\\b)', bygroups(Name.Builtin.Pseudo)),
274 (u'(\\b(?:bin_packing|bin_packing_capa|bin_packing_load|diffn|diffn_k|diffn_nonstrict|diffn_nonstrict_k|geost|geost_bb|geost_smallest_bb|knapsack)\\b)', bygroups(Name.Builtin.Pseudo)),
275 (u'(\\b(?:alternative|cumulative|disjunctive|disjunctive_strict|span)\\b)', bygroups(Name.Builtin.Pseudo)),
276 (u'(\\b(?:regular|regular_nfa|table)\\b)', bygroups(Name.Builtin.Pseudo)),
277 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')(\\()', bygroups(Name.Function, Punctuation), 'main__4'),
278 (u'(\\b[A-Za-z][A-Za-z0-9_]*|\'[^\'\\n\\r]*\')', bygroups(Name.Variable)),
279 ('(\n|\r|\r\n)', String),
280 ('.', String),
281 ]
282 }
283
284class MznDefLexer(MznLexer):
285 name = 'MiniZincDef'
286 aliases = ['minizincdef']
287
288 tokens = {
289 'root': [
290 (r'<[0-9a-zA-Z- ]+>', Comment.Special),
291 (r'"/\\"', String),
292 (r'"""', String),
293 (r'"\\\("', String),
294 (r'"\\.\\.\\."', Comment.Special),
295 (r'\[[^ ]', String.Regex, 'regex'),
296 (r'::=', Comment.Special),
297 (words(('|',), prefix=r'^\s*'), Comment.Special),
298 inherit
299 ],
300 'main__1': [
301 (r'<[0-9a-zA-Z- ]+>', Comment.Special),
302 (r'"/\\"', String),
303 (r'"""', String),
304 (r'"\\\("', String),
305 (r'"\\.\\.\\."', String),
306 (r'\[[^ ]', String.Regex, 'regex'),
307 (r'::=', Comment.Special),
308 (words(('|',), prefix=r'^\s*'), Comment.Special),
309 inherit
310 ],
311 'main__2': [
312 (r'<[0-9a-zA-Z- ]+>', Comment.Special),
313 (r'"/\\"', String),
314 (r'"""', String),
315 (r'"\\\("', String),
316 (r'"\\.\\.\\."', String),
317 (r'\[[^ ]', String.Regex, 'regex'),
318 (r'::=', Comment.Special),
319 (words(('|',), prefix=r'^\s*'), Comment.Special),
320 inherit
321 ],
322 'main__3': [
323 (r'<[0-9a-zA-Z- ]+>', Comment.Special),
324 (r'"/\\"', String),
325 (r'"""', String),
326 (r'"\\\("', String),
327 (r'"\\.\\.\\."', String),
328 (r'\[[^ ]', String.Regex, 'regex'),
329 (r'::=', Comment.Special),
330 (words(('|',), prefix=r'^\s*'), Comment.Special),
331 inherit
332 ],
333 'main__4': [
334 (r'<[0-9a-zA-Z- ]+>', Comment.Special),
335 (r'"/\\"', String),
336 (r'"""', String),
337 (r'"\\\("', String),
338 (r'"\\.\\.\\."', String),
339 (r'\[[^ ]', String.Regex, 'regex'),
340 (r'::=', Comment.Special),
341 (words(('|',), prefix=r'^\s*'), Comment.Special),
342 inherit
343 ],
344 'regex': [
345 (r'\]', String.Regex, '#pop'),
346 (r'.', String.Regex)
347 ]
348 }