Advertisement
Guest User

Working PCR syntax

a guest
Aug 29th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.06 KB | None | 0 0
  1. %YAML 1.2
  2. ---
  3. name: FullProf PCR
  4. scope: source.pcr
  5. file_extensions: [pcr]
  6.  
  7. variables:
  8.   number: '-?\d+(\.\d+)?([eE][+-]\d+)?'
  9.   zeroes: '-?0\.0+([eE][+-]\d+)?'
  10.   element: '[A-Z][A-Za-z0-9+\-]*'
  11.  
  12. contexts:
  13.   main:
  14.     - match: '(?i)^!(?=\s*Atom)'
  15.       scope: punctuation.definition.comment.pcr
  16.       push: atomic-comment
  17.     - match: '^!'
  18.       scope: punctuation.definition.comment.pcr
  19.       push: generic-comment
  20.  
  21.   end-block:
  22.     - match: '^(?=\!)'
  23.       pop: true
  24.  
  25.   inline-comment:
  26.     - match: '!'
  27.       scope: punctuation.definition.comment.pcr
  28.       push:
  29.       - meta_scope: comment.line.pcr
  30.       - match: '\n'
  31.         pop: true
  32.  
  33.   values:
  34.     - match: '{{number}}'
  35.       scope: constant.other.pcr
  36.  
  37.   codewords:
  38.     - match: '{{zeroes}}'
  39.       scope: comment.line.pcr
  40.     - match: '{{number}}'
  41.       scope: keyword.control.pcr
  42.  
  43.  
  44. # Generic lines :
  45. # - comment
  46. # - values
  47. # - codewords (optional)
  48.  
  49.   generic-comment:
  50.     - meta_scope: comment.line.pcr
  51.     - match: '\n'
  52.       set: generic-values
  53.  
  54.   generic-values:
  55.     - meta_content_scope: meta.generic-values.pcr
  56.     - include: end-block
  57.     - include: inline-comment
  58.     - include: values
  59.     - match: '\n'
  60.       set: generic-codewords
  61.  
  62.   generic-codewords:
  63.     - meta_content_scope: meta.generic-codewords.pcr
  64.     - include: end-block
  65.     - include: inline-comment
  66.     - include: codewords
  67.     - match: '\n'
  68.       pop: true
  69.  
  70. # Atomic content lines :
  71. # - comment
  72. # - values
  73. # - codewords
  74. # - values
  75. # - codewords
  76. # - etc.
  77.  
  78.   atomic-comment:
  79.     - meta_scope: comment.line.pcr
  80.     - match: '\n'
  81.       set: atomic-values
  82.  
  83.   atomic-values:
  84.     - meta_scope: meta.atomic-values.pcr
  85.     - include: end-block
  86.     - include: inline-comment
  87.     - match: '{{element}}'
  88.       scope: string.unquoted
  89.     - include: values
  90.     - match: '\n'
  91.       set: atomic-codewords
  92.  
  93.   atomic-codewords:
  94.     - meta_scope: meta.atomic-codewords.pcr
  95.     - include: end-block
  96.     - include: inline-comment
  97.     - include: codewords
  98.     - match: '\n'
  99.       set: atomic-values
  100.  
  101. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement