Advertisement
Guest User

Untitled

a guest
May 15th, 2021
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. #################################################################
  2. ## Iro
  3. ################################################################
  4. ##
  5. ## * Press Ctrl + '+'/'-' To Zoom in
  6. ## * Press Ctrl + S to save and recalculate...
  7. ## * Documents are saved to web storage.
  8. ## * Only one save slot supported.
  9. ## * Matches cannot span lines.
  10. ## * Unicode chars must be defined in \u0000 to \uffff format.
  11. ## * All matches must be contained by a single group ( ... )
  12. ## * Look behinds not permitted, (?<= or (?<!
  13. ## * Look forwards are permitted (?= or (?!
  14. ## * Constants are defined as __my_const = (......)
  15. ## * The \= format allows unescaped regular expressions
  16. ## * Constants referenced by match \= $${__my_const}
  17. ## * Constants can reference other constants
  18. ## * You are free to delete all the default scopes.
  19. ## * Twitter : ainslec , Web: http://eeyo.io/iro
  20. ##
  21. ################################################################
  22.  
  23. name = mysample
  24. file_extensions [] = mysample;
  25.  
  26. ################################################################
  27. ## Constants
  28. ################################################################
  29.  
  30. __MY_CONSTANT \= (\b[a-z][a-z0-9]*)
  31.  
  32. ################################################################
  33. ## Styles
  34. ################################################################
  35.  
  36. styles [] {
  37.  
  38. .comment : style {
  39. color = light_green
  40. italic = true
  41. ace_scope = comment
  42. textmate_scope = comment
  43. pygments_scope = Comment
  44. }
  45.  
  46. .keyword : style {
  47. color = cyan
  48. ace_scope = keyword
  49. textmate_scope = keyword
  50. pygments_scope = Keyword
  51. }
  52.  
  53. .numeric : style {
  54. color = gold
  55. ace_scope = constant.numeric
  56. textmate_scope = constant.numeric
  57. pygments_scope = Number
  58. }
  59.  
  60. .punctuation : style {
  61. color = red_2
  62. ace_scope = punctuation
  63. textmate_scope = punctuation
  64. pygments_scope = Punctuation
  65. }
  66.  
  67. .text : style {
  68. color = brown
  69. ace_scope = text
  70. textmate_scope = text
  71. pygments_scope = String
  72. }
  73.  
  74. .illegal : style {
  75. color = white
  76. background_color = red
  77. ace_scope = invalid
  78. textmate_scope = invalid
  79. pygments_scope = Generic.Error
  80. }
  81.  
  82. }
  83.  
  84. #################################################
  85. ## Parse contexts
  86. #################################################
  87.  
  88. contexts [] {
  89.  
  90. ##############################################
  91. ## Main Context - Entry point context
  92. ##############################################
  93.  
  94. main : context {
  95.  
  96. : pattern {
  97. regex \= $${__MY_CONSTANT}
  98. styles [] = .keyword;
  99. }
  100.  
  101. : include "numeric" ;
  102.  
  103. : inline_push {
  104. regex \= (\{)
  105. styles [] = .punctuation;
  106. : pop {
  107. regex \= (\})
  108. styles [] = .punctuation;
  109. }
  110. : include "main" ;
  111. }
  112.  
  113. : pattern {
  114. regex \= (;)
  115. styles [] = .punctuation;
  116. }
  117.  
  118. : inline_push {
  119. regex \= (\")(?=h)
  120. styles [] = .punctuation;
  121. default_style = .text
  122. : pop {
  123. regex \= (\")
  124. styles [] = .punctuation;
  125. }
  126. }
  127.  
  128. : inline_push {
  129. regex \= (\()
  130. styles [] = .punctuation;
  131. : pop {
  132. regex \= (\))
  133. styles [] = .punctuation;
  134. }
  135. : include "numeric" ;
  136. : pattern {
  137. regex \= (,)
  138. styles [] = .punctuation;
  139. }
  140. }
  141.  
  142. : include "multi_line_comment" ;
  143.  
  144. : pattern {
  145. regex \= (//.*)
  146. styles [] = .comment;
  147. }
  148.  
  149. : pattern {
  150. regex \= ([^\s])
  151. styles [] = .illegal;
  152. }
  153.  
  154. }
  155.  
  156. #################################################
  157. ## End of Contexts
  158. #################################################
  159.  
  160. ###########################################
  161. ## Numeric Context
  162. ###########################################
  163.  
  164. numeric : context {
  165. : pattern {
  166. regex \= (\b\d+)
  167. styles [] = .numeric;
  168. }
  169. }
  170.  
  171. ###########################################
  172. ## Multi Line Comment Context
  173. ###########################################
  174.  
  175. multi_line_comment : context {
  176. description = multiline
  177. : inline_push {
  178. regex \= (/\*)
  179. styles [] = .comment;
  180. default_style = .comment
  181. : pop {
  182. regex \= (\*/)
  183. styles [] = .comment;
  184. }
  185. }
  186. }
  187.  
  188. }
  189.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement