-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphits.sublime-syntax
72 lines (57 loc) · 2.59 KB
/
phits.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
%YAML 1.2
---
# Look at the README.md for info
name: PHITS input
file_extensions: [inp]
scope: input.phits
contexts:
main:
# Parameters
- match: '(?i)[a-z()0-9<>-]+\s+(?=\=)|infl:'
scope: entity.other.attribute-name
# Comments begin with a $ or # and finish at the end of the line
- match: '\$|\#\D'
scope: comment
push: line_comment
# Keywords (sections)
# Note that blackslashes don't need to be escaped within single quoted
# strings in YAML. When using single quoted strings, only single quotes
# need to be escaped: this is done by using two single quotes next to each
# other.
- match: '\[ .+ \]'
scope: markup.heading punctuation.definition.heading
# Particles and elements
- match: '\b(all|photon|neutron|proton|pion-?|muon[-]*|kaon[+-0]?|electron|positron|deuteron|triton|3he|alpha|[0-9]{0,3}A[cglmrstu]|[0-9]{0,3}B[aehikr]?|[0-9]{0,3}C[adeflmnorsu]?|[0-9]{0,3}D[bsy]|[0-9]{0,3}E[rsu]|[0-9]{0,3}F[elmr]?|[0-9]{0,3}G[ade]|[0-9]{0,3}H[efgos]?|[0-9]{0,3}I[nr]?|[0-9]{0,3}Kr?|[0-9]{0,3}L[airuv]|[0-9]{0,3}M[dgnot]|[0-9]{0,3}N[abdeiop]?|[0-9]{0,3}Os?|[0-9]{0,3}P[abdmortu]?|[0-9]{0,3}R[abefghnu]|[0-9]{0,3}S[bcegimnr]?|[0-9]{0,3}T[abcehilm]|[0-9]{0,3}U(u[opst])?|[0-9]{0,3}V|[0-9]{0,3}W|[0-9]{0,3}Xe|[0-9]{0,3}Yb?|[0-9]{0,3}Z[nr])\b'
scope: keyword
# Surfaces
- match: '(?i)\b(p[xyz]*|s[oxyzq]*|c/?[xyz]|k/?[xyz]|gq|t[xyz]|box|rpp|sph|rcc|rhp|hex|rec|trc|ell|wed)\b'
scope: support.constant
# Functions
- match: '(?i)\b(float|int|abs|exp|log|log10|max|min|mod|nint|sign|sqrt|a?sinh?|a?tan2?h?|a?cosh?|ymin|ymax)\b'
scope: support.constant
# Axis
- match: '\b(eng|reg|[xyzrt]{1,3}|cos|the|mass|charge|chart|dchain|let|t-eng|eng-t|t-el|el-t|t-e2|e2-t|e12|e21)\b'
scope: variable.parameter
# mat, set, ifl
- match: '(?i)\b(mat|set:\s?*|infl:|VOL|GAS)\b'
scope: entity.other.attribute-name
# Sub titles
- match: '(\s?+mat\s+name\s+color|\s?+mat\s+name\s+size\s+color|\s?+non\s+r-from\s+r-to\s+area|\s?+r-from\s+r-to\s+area|\s?+reg\s+typ\s+gap\s+mgf\s+trcl\s+polar\s+time|\s?+reg\s+del|\s?+reg\s+mID|\s?+reg\s+vol|\s?+reg\s+name\s+size|\s?+reg\s+imp)'
scope: entity.other.inherited-class
# Numbers
# - match: '\b[-+]?[0-9]*\.?[0-9]+\b'
- match: '-?\b[\d.]+(?:[eE][-+]?\d+)?\b'
scope: constant.numeric
# Variables
- match: '\b(c[0-9]{1,3}|pi)\b'
scope: keyword
# Paths, signs etc
- match: '[=#]'
scope: string
# Brackets
- match: '{.+}'
scope: diff.inserted
line_comment:
- meta_scope: comment
- match: '\n'
pop: true