-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPLI10.sublime-syntax
146 lines (102 loc) · 3.53 KB
/
PLI10.sublime-syntax
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
%YAML 1.2
---
name: PLI10
file_extensions:
- eap
scope: source.pli10
contexts:
main:
# Match comments (multi-line comments)
# Comments are first here cause i want them to take
# priority.
- match: '/\*'
push:
- meta_scope: comment.block.pli10
- match: '\*/'
pop: true
- match: '[^*]*'
scope: comment.block.pli10
# Match strings
- match: '"([^"\\]|\\.)*?"'
scope: string.quoted.double.pli10
# Main keywords
- match: '\b(ΑΛΓΟΡΙΘΜΟΣ|ΣΤΑΘΕΡΕΣ|ΔΕΔΟΜΕΝΑ|ΣΥΝΑΡΤΗΣΗ|ΔΙΑΔΙΚΑΣΙΑ|ΑΡΧΗ|ΤΕΛΟΣ|ARRAY|OF|ΤΥΠΟΙ|ΥΠΟΛΟΓΙΣΕ|ΔΙΑΔΙΚΑΣΙΑΣ|ΣΥΝΑΡΤΗΣΗΣ|ΔΙΕΠΑΦΗ|ΕΙΣΟΔΟΣ|ΕΞΟΔΟΣ)\b'
scope: keyword.control.pli10
- match: '\b(ΕΑΝ|ΤΟΤΕ|ΑΛΛΙΩΣ|ΓΙΑ|ΕΩΣ|ΜΕ|ΒΗΜΑ|ΕΠΑΝΑΛΑΒΕ|ΕΝΟΣΩ|ΜΕΧΡΙ)\b'
scope: keyword.control.flow.conditional.pli10
# Operators
- match: '\b(MOD|DIV|AND|OR|NOT)\b'
scope: keyword.operator.pli10
- match: '(\+|-|\*|/|=|:=|<|>|<=|>=|<>|;|,|:|&)'
scope: keyword.operator.pli10
# \s -> space, \b -> word boundary, ?<= -> look behind
# - match: '(?<=\s|\b)(\+|-|\*|/|=|:=|<|>|<=|>=|<>|;|,|:|&)(?=\s|\b)'
# scope: keyword.operator.pli10
- match: '\b(ΔΙΑΒΑΣΕ|ΕΚΤΥΠΩΣΕ|ΤΥΠΩΣΕ|EOLN)\b'
scope: support.function.builtin.pli10
- match: '\b(SQRT|LOG|ABS|FLOOR|SIN|COS|POW)\b'
scope: entity.name.function.pli10
# Storage type variables
- match: '\b(INTEGER|REAL|BOOLEAN|CHAR|STRING|POINTER)\b'
scope: storage.type.pli10
# Boolean Keywords
- match: '\b(TRUE|FALSE)\b'
scope: constant.language.boolean.pli10
- match: '\b(ΣΩΣΤΟ|ΛΑΘΟΣ)\b'
scope: constant.language.boolean.pli10
- match: '\b(ΑΛΗΘΗΣ|ΨΕΥΔΗΣ)\b'
scope: constant.language.boolean.pli10
# Numbers (integer and real numbers)
- match: '\b\d+(\.\d+)?\b'
scope: constant.numeric.pli10
# Match variables (use a regular expression for better flexibility)
- match: /\b[a-zA-Z_][a-zA-Z0-9_]*\b/
scope: variable.other.pli10
# Invalid brackets if there are alone
- match: \(
push: brackets
scope: punctuation.section.group.begin
- match: \)
scope: invalid.illegal.stray-bracket-end
- match: \[
push: brackets
- match: \]
scope: invalid.illegal.stray-bracket-end
- match: \{
push: brackets
- match: \}
scope: invalid.illegal.stray-bracket-end
# Match parentheses, square brackets, and curly brackets
#- match: '[\[\]{}()]'
- match: '[\[\]\(\)\{\}]'
scope: punctuation.section.pli10
# Special handling for strings and comments and brackets
string:
- match: '"'
scope: punctuation.definition.string.begin.pli10
push:
- meta_scope: string.quoted.double.pli10
- match: '"'
scope: punctuation.definition.string.end.pli10
pop: true
- match: '\\.'
scope: constant.character.escape.pli10
- match: '[^"\\]+'
scope: string.quoted.double.pli10
comment:
- match: '/\*'
scope: punctuation.definition.comment.begin.pli10
push:
- match: '\*/'
scope: punctuation.definition.comment.end.pli10
pop: true
- match: '[^*]*'
scope: comment.block.pli10
brackets:
- match: \)
pop: true
- match: \]
pop: true
- match: \}
pop: true
- include: main