rouge 2.0.7 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -9
  3. data/lib/rouge.rb +1 -0
  4. data/lib/rouge/cli.rb +20 -0
  5. data/lib/rouge/demos/awk +4 -0
  6. data/lib/rouge/demos/console +6 -0
  7. data/lib/rouge/demos/digdag +19 -0
  8. data/lib/rouge/demos/dot +5 -0
  9. data/lib/rouge/demos/graphql +17 -0
  10. data/lib/rouge/demos/hylang +10 -0
  11. data/lib/rouge/demos/igorpro +9 -0
  12. data/lib/rouge/demos/irb +4 -0
  13. data/lib/rouge/demos/irb_output +2 -0
  14. data/lib/rouge/demos/lasso +12 -0
  15. data/lib/rouge/demos/mosel +10 -0
  16. data/lib/rouge/demos/plist +142 -0
  17. data/lib/rouge/demos/pony +17 -0
  18. data/lib/rouge/demos/q +2 -0
  19. data/lib/rouge/demos/sieve +10 -0
  20. data/lib/rouge/demos/tsx +17 -0
  21. data/lib/rouge/demos/turtle +0 -0
  22. data/lib/rouge/demos/wollok +11 -0
  23. data/lib/rouge/formatters/html_inline.rb +9 -1
  24. data/lib/rouge/formatters/html_pygments.rb +2 -2
  25. data/lib/rouge/formatters/html_table.rb +1 -1
  26. data/lib/rouge/formatters/terminal256.rb +1 -1
  27. data/lib/rouge/lexer.rb +124 -37
  28. data/lib/rouge/lexers/abap.rb +2 -2
  29. data/lib/rouge/lexers/apache.rb +1 -1
  30. data/lib/rouge/lexers/awk.rb +161 -0
  31. data/lib/rouge/lexers/clojure.rb +2 -2
  32. data/lib/rouge/lexers/coffeescript.rb +1 -1
  33. data/lib/rouge/lexers/console.rb +136 -0
  34. data/lib/rouge/lexers/csharp.rb +26 -7
  35. data/lib/rouge/lexers/digdag.rb +72 -0
  36. data/lib/rouge/lexers/docker.rb +1 -1
  37. data/lib/rouge/lexers/dot.rb +68 -0
  38. data/lib/rouge/lexers/elixir.rb +52 -27
  39. data/lib/rouge/lexers/fortran.rb +56 -28
  40. data/lib/rouge/lexers/fsharp.rb +1 -1
  41. data/lib/rouge/lexers/gherkin/keywords.rb +4 -4
  42. data/lib/rouge/lexers/graphql.rb +243 -0
  43. data/lib/rouge/lexers/groovy.rb +5 -1
  44. data/lib/rouge/lexers/haml.rb +19 -24
  45. data/lib/rouge/lexers/html.rb +48 -4
  46. data/lib/rouge/lexers/hylang.rb +93 -0
  47. data/lib/rouge/lexers/igorpro.rb +407 -0
  48. data/lib/rouge/lexers/irb.rb +66 -0
  49. data/lib/rouge/lexers/javascript.rb +21 -10
  50. data/lib/rouge/lexers/json.rb +3 -2
  51. data/lib/rouge/lexers/json_doc.rb +6 -0
  52. data/lib/rouge/lexers/jsx.rb +2 -1
  53. data/lib/rouge/lexers/lasso.rb +217 -0
  54. data/lib/rouge/lexers/lasso/keywords.yml +446 -0
  55. data/lib/rouge/lexers/lua.rb +3 -0
  56. data/lib/rouge/lexers/lua/builtins.rb +1 -1
  57. data/lib/rouge/lexers/markdown.rb +2 -3
  58. data/lib/rouge/lexers/matlab/builtins.rb +1 -1
  59. data/lib/rouge/lexers/moonscript.rb +8 -4
  60. data/lib/rouge/lexers/mosel.rb +231 -0
  61. data/lib/rouge/lexers/ocaml.rb +9 -20
  62. data/lib/rouge/lexers/php.rb +40 -20
  63. data/lib/rouge/lexers/php/builtins.rb +27 -37
  64. data/lib/rouge/lexers/plain_text.rb +4 -3
  65. data/lib/rouge/lexers/plist.rb +49 -0
  66. data/lib/rouge/lexers/pony.rb +93 -0
  67. data/lib/rouge/lexers/powershell.rb +36 -0
  68. data/lib/rouge/lexers/properties.rb +2 -2
  69. data/lib/rouge/lexers/q.rb +124 -0
  70. data/lib/rouge/lexers/r.rb +2 -2
  71. data/lib/rouge/lexers/ruby.rb +26 -13
  72. data/lib/rouge/lexers/rust.rb +7 -5
  73. data/lib/rouge/lexers/sed.rb +4 -2
  74. data/lib/rouge/lexers/shell.rb +38 -16
  75. data/lib/rouge/lexers/sieve.rb +96 -0
  76. data/lib/rouge/lexers/sml.rb +3 -2
  77. data/lib/rouge/lexers/tsx.rb +19 -0
  78. data/lib/rouge/lexers/turtle.rb +0 -0
  79. data/lib/rouge/lexers/typescript.rb +3 -27
  80. data/lib/rouge/lexers/typescript/common.rb +33 -0
  81. data/lib/rouge/lexers/viml/keywords.rb +2 -2
  82. data/lib/rouge/lexers/wollok.rb +107 -0
  83. data/lib/rouge/lexers/xml.rb +1 -1
  84. data/lib/rouge/lexers/yaml.rb +4 -1
  85. data/lib/rouge/regex_lexer.rb +1 -0
  86. data/lib/rouge/template_lexer.rb +3 -5
  87. data/lib/rouge/theme.rb +14 -4
  88. data/lib/rouge/themes/igor_pro.rb +20 -0
  89. data/lib/rouge/themes/pastie.rb +69 -0
  90. data/lib/rouge/themes/thankful_eyes.rb +8 -5
  91. data/lib/rouge/version.rb +1 -1
  92. metadata +40 -6
  93. data/lib/rouge/demos/shell_session +0 -10
  94. data/lib/rouge/lexers/shell_session.rb +0 -29
@@ -7,11 +7,11 @@ module Rouge
7
7
  module Lexers
8
8
  class Fortran < RegexLexer
9
9
  title "Fortran"
10
- desc "Fortran 95 Programming Language"
10
+ desc "Fortran 2008 (free-form)"
11
11
 
12
12
  tag 'fortran'
13
- filenames '*.f90', '*.f95',
14
- '*.F90', '*.F95'
13
+ filenames '*.f90', '*.f95', '*.f03', '*.f08',
14
+ '*.F90', '*.F95', '*.F03', '*.F08'
15
15
  mimetypes 'text/x-fortran'
16
16
 
17
17
  name = /[A-Z][_A-Z0-9]*/i
@@ -21,40 +21,64 @@ module Rouge
21
21
  def self.keywords
22
22
  # Fortran allows to omit whitespace between certain keywords...
23
23
  @keywords ||= Set.new %w(
24
- allocatable allocate assignment backspace block blockdata call case
25
- close common contains continue cycle data deallocate default
26
- dimension do elemental else elseif elsewhere end endblockdata enddo
27
- endfile endforall endfunction endif endinterface endmodule endprogram
28
- endselect endsubroutine endtype endwhere entry equivalence exit
29
- external forall format function go goto if implicit in include inout
30
- inquire intent interface intrinsic module namelist none nullify only
31
- open operator optional out parameter pointer print private procedure
32
- program public pure read recursive result return rewind save select
33
- selectcase sequence stop subroutine target then to type use where
34
- while write
24
+ abstract all allocatable allocate assign assignment asynchronous
25
+ backspace bind block blockdata close common concurrent contiguous call
26
+ case class codimension contains continue cycle data deallocate
27
+ deferred dimension do elemental else elseif elsewhere end endblock
28
+ endblockdata enddo endenum endfile endforall endfunction endif
29
+ endinterface endmodule endprogram endselect endsubmodule endsubroutine
30
+ endtype endwhere endwhile entry enum enumerator equivalence error exit
31
+ external final flush forall format function generic go goto if
32
+ implicit import in include inout inquire intent interface intrinsic is
33
+ module namelist non_overridable none nopass nullify only open operator
34
+ optional out parameter pass pause pointer print private procedure
35
+ program protected public pure read recursive result return rewind save
36
+ select selectcase sequence stop submodule subroutine target then to
37
+ type use value volatile wait where while write
35
38
  )
36
39
  end
37
40
 
38
41
  def self.types
42
+ # There is a separate rule for "double precision" (two words) below
39
43
  @types ||= Set.new %w(
40
- character complex double precision doubleprecision integer logical real
44
+ character complex doubleprecision integer logical real
41
45
  )
42
46
  end
43
47
 
44
48
  def self.intrinsics
45
49
  @intrinsics ||= Set.new %w(
46
- abs achar acos adjustl adjustr aimag aint all allocated anint any
47
- asin associated atan atan2 bit_size btest ceiling char cmplx conjg
48
- cos cosh count cpu_time cshift date_and_time dble digits dim
49
- dot_product dprod eoshift epsilon exp exponent floor fraction huge
50
- iachar iand ibclr ibits ibset ichar ieor index int ior ishift ishiftc
51
- kind lbound len len_trim lge lgt lle llt log log10 logical matmul max
52
- maxexponent maxloc maxval merge min minexponent minloc minval mod
53
- modulo mvbits nearest nint not null pack precision present product
54
- radix random_number random_seed range real repeat reshape rrspacing
55
- scale scan selected_int_kind selected_real_kind set_exponent shape
56
- sign sin sinh size spacing spread sqrt sum system_clock tan tanh tiny
57
- transfer transpose trim ubound unpack verify
50
+ abs achar acos acosh adjustl adjustr aimag aint all allocated anint
51
+ any asin asinh associated atan atan2 atanh bessel_j0 bessel_j1
52
+ bessel_jn bessel_y0 bessel_y1 bessel_yn bge bgt bit_size ble blt btest
53
+ c_associated c_f_pointer c_f_procpointer c_funloc c_loc c_sizeof
54
+ ceiling char cmplx command_argument_count compiler_options
55
+ compiler_version conjg cos cosh count cpu_time cshift date_and_time
56
+ dble digits dim dot_product dprod dshiftl dshiftr eoshift epsilon erf
57
+ erfc_scaled erfc execute_command_line exp exponent extends_type_of
58
+ findloc floor fraction gamma get_command_argument get_command
59
+ get_environment_variable huge hypot iachar iall iand iany ibclr ibits
60
+ ibset ichar ieee_class ieee_copy_sign ieee_get_flag
61
+ ieee_get_halting_mode ieee_get_rounding_mode ieee_get_status
62
+ ieee_get_underflow_mode ieee_is_finite ieee_is_nan ieee_is_normal
63
+ ieee_logb ieee_next_after ieee_rem ieee_rint ieee_scalb
64
+ ieee_selected_real_kind ieee_set_flag ieee_set_halting_mode
65
+ ieee_set_rounding_mode ieee_set_status ieee_set_underflow_mode
66
+ ieee_support_datatype ieee_support_denormal ieee_support_divide
67
+ ieee_support_flag ieee_support_halting ieee_support_inf
68
+ ieee_support_io ieee_support_nan ieee_support_rounding
69
+ ieee_support_sqrt ieee_support_standard ieee_support_underflow_control
70
+ ieee_unordered ieee_value ieor image_index index int ior iparity
71
+ is_contiguous is_iostat_end is_iostat_eor ishft ishftc kind lbound
72
+ lcobound leadz len_trim len lge lgt lle llt log_gamma log log10
73
+ logical maskl maskr matmul max maxexponent maxloc maxval merge_bits
74
+ merge min minexponent minloc minval mod modulo move_alloc mvbits
75
+ nearest new_line nint norm2 not null num_images pack parity popcnt
76
+ poppar present product radix random_number random_seed range real
77
+ repeat reshape rrspacing same_type_as scale scan selected_char_kind
78
+ selected_int_kind selected_real_kind set_exponent shape shifta shiftl
79
+ shiftr sign sin sinh size spacing spread sqrt storage_size sum
80
+ system_clock tan tanh this_image tiny trailz transfer transpose trim
81
+ ubound ucobound unpack verify
58
82
  )
59
83
  end
60
84
 
@@ -63,7 +87,7 @@ module Rouge
63
87
  rule /!.*$/, Comment::Single
64
88
  rule /^#.*$/, Comment::Preproc
65
89
 
66
- rule /::|[()\/;,:&]/, Punctuation
90
+ rule /::|[()\/;,:&\[\]]/, Punctuation
67
91
 
68
92
  # TODO: This does not take into account line continuation.
69
93
  rule /^(\s*)([0-9]+)\b/m do |m|
@@ -100,6 +124,10 @@ module Rouge
100
124
  rule %r{\*\*|//|==|/=|<=|>=|=>|[-+*/<>=%]}, Operator
101
125
  rule /\.(?:EQ|NE|LT|LE|GT|GE|NOT|AND|OR|EQV|NEQV|[A-Z]+)\./i, Operator::Word
102
126
 
127
+ # To make sure "double precision" written as two words is highlighted
128
+ # properly. "doubleprecision" is covered by a different rule.
129
+ rule /double\s+precision\b/i, Keyword::Type
130
+
103
131
  rule /#{name}/m do |m|
104
132
  match = m[0].downcase
105
133
  if self.class.keywords.include? match
@@ -50,7 +50,7 @@ module Rouge
50
50
  rule /#{upper_id}(?=\s*[.])/, Name::Namespace, :dotted
51
51
  rule upper_id, Name::Class
52
52
  rule /[(][*](?![)])/, Comment, :comment
53
- rule %r(//.*?\n), Comment::Single
53
+ rule %r(//.*?$), Comment::Single
54
54
  rule id do |m|
55
55
  match = m[0]
56
56
  if self.class.keywords.include? match
@@ -4,10 +4,10 @@ module Rouge
4
4
  module Lexers
5
5
  def Gherkin.keywords
6
6
  @keywords ||= {}.tap do |k|
7
- k[:feature] = Set.new ["Ability", "Ahoy matey!", "Arwedd", "Aspekt", "Besigheid Behoefte", "Business Need", "Caracteristica", "Característica", "Egenskab", "Egenskap", "Eiginleiki", "Feature", "Fitur", "Fonctionnalité", "Fonksyonalite", "Funcionalidade", "Funcionalitat", "Functionalitate", "Functionaliteit", "Funcţionalitate", "Funcționalitate", "Fungsi", "Funkcia", "Funkcija", "Funkcionalitāte", "Funkcionalnost", "Funkcja", "Funksie", "Funktionalität", "Funktionalitéit", "Funzionalità", "Fīča", "Hwaet", "Hwæt", "Jellemző", "Karakteristik", "Lastnost", "Mak", "Mogucnost", "Mogućnost", "Moznosti", "Možnosti", "OH HAI", "Omadus", "Ominaisuus", "Osobina", "Potrzeba biznesowa", "Požadavek", "Požiadavka", "Pretty much", "Qap", "Qu'meH 'ut", "Savybė", "Trajto", "Tính năng", "Vermoë", "Vlastnosť", "Właściwość", "Značilnost", "laH", "perbogh", "poQbogh malja'", "Özellik", "Δυνατότητα", "Λειτουργία", "Могућност", "Мөмкинлек", "Особина", "Свойство", "Функционал", "Функционалност", "Функция", "Функціонал", "Үзенчәлеклелек", "תכונה", "خاصية", "خصوصیت", "صلاحیت", "وِیژگی", "کاروبار کی ضرورت", "रूप लेख", "ਖਾਸੀਅਤ", "ਨਕਸ਼ ਨੁਹਾਰ", "ਮੁਹਾਂਦਰਾ", "గుణము", "ಹೆಚ್ಚಳ", "ความต้องการทางธุรกิจ", "ความสามารถ", "โครงหลัก", "フィーチャ", "功能", "機能", "기능"]
8
- k[:element] = Set.new ["Abstract Scenario", "Abstrakt Scenario", "Achtergrond", "Aer", "Agtergrond", "All y'all", "Antecedentes", "Antecedents", "Atburðarás", "Awww, look mate", "B4", "Background", "Baggrund", "Bakgrund", "Bakgrunn", "Bakgrunnur", "Bối cảnh", "Cefndir", "Cenario", "Cenario de Fundo", "Cenário", "Cenário de Fundo", "Contesto", "Context", "Contexte", "Contexto", "Dasar", "Delineacao do Cenario", "Delineação do Cenário", "Dis is what went down", "Dyagram Senaryo", "Dyagram senaryo", "Esbozo do escenario", "Escenari", "Escenario", "Esquema de l'escenari", "Esquema del escenario", "Esquema do Cenario", "Esquema do Cenário", "First off", "Fono", "Forgatókönyv", "Forgatókönyv vázlat", "Fundo", "Geçmiş", "Grundlage", "Hannergrond", "Heave to", "Háttér", "Istorik", "Keadaan", "Khung kịch bản", "Khung tình huống", "Koncept", "Konsep skenario", "Kontekst", "Kontekstas", "Konteksts", "Kontext", "Konturo de la scenaro", "Kontèks", "Kịch bản", "Latar Belakang", "Lýsing Atburðarásar", "Lýsing Dæma", "MISHUN", "MISHUN SRSLY", "Menggariskan Senario", "Náčrt Scenára", "Náčrt Scenáru", "Náčrt Scénáře", "Oris scenarija", "Osnova", "Osnova Scenára", "Osnova scénáře", "Osnutek", "Ozadje", "Plan Senaryo", "Plan du Scénario", "Plan du scénario", "Plan senaryo", "Plang vum Szenario", "Pozadie", "Pozadina", "Pozadí", "Primer", "Raamstsenaarium", "Reckon it's like", "Rerefons", "Scenarie", "Scenarij", "Scenarijaus šablonas", "Scenarijus", "Scenario", "Scenario Amlinellol", "Scenario Outline", "Scenario Template", "Scenariomal", "Scenariomall", "Scenariu", "Scenariusz", "Scenaro", "Scenár", "Scenārijs", "Scenārijs pēc parauga", "Schema dello scenario", "Scénario", "Scénář", "Senario", "Senaryo", "Senaryo Deskripsyon", "Senaryo deskripsyon", "Senaryo taslağı", "Shiver me timbers", "Situai", "Situasie", "Situasie Uiteensetting", "Situācija", "Skenario", "Skenario konsep", "Skica", "Structura scenariu", "Structură scenariu", "Struktura scenarija", "Stsenaarium", "Swa", "Swa hwaer swa", "Swa hwær swa", "Szablon scenariusza", "Szenario", "Szenariogrundriss", "Tapaus", "Tapausaihio", "Taust", "Tausta", "Template Keadaan", "Template Senario", "Template Situai", "The thing of it is", "Tình huống", "Wharrimean is", "Yo-ho-ho", "Założenia", "lut", "lut chovnatlh", "mo'", "Ær", "Περιγραφή Σεναρίου", "Σενάριο", "Υπόβαθρο", "Кереш", "Контекст", "Концепт", "Основа", "Передумова", "Позадина", "Предистория", "Предыстория", "Пример", "Рамка на сценарий", "Скица", "Структура сценария", "Структура сценарија", "Структура сценарію", "Сценарий", "Сценарий структураси", "Сценарийның төзелеше", "Сценарио", "Сценарій", "Тарих", "רקע", "תבנית תרחיש", "תרחיש", "الخلفية", "الگوی سناریو", "زمینه", "سناریو", "سيناريو", "سيناريو مخطط", "منظر نامے کا خاکہ", "منظرنامہ", "پس منظر", "परिदृश्य", "परिदृश्य रूपरेखा", "पृष्ठभूमि", "ਪਟਕਥਾ", "ਪਟਕਥਾ ਢਾਂਚਾ", "ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ", "ਪਿਛੋਕੜ", "కథనం", "నేపథ్యం", "సన్నివేశం", "ಕಥಾಸಾರಾಂಶ", "ವಿವರಣೆ", "ಹಿನ್ನೆಲೆ", "สรุปเหตุการณ์", "เหตุการณ์", "แนวคิด", "โครงสร้างของเหตุการณ์", "シナリオ", "シナリオアウトライン", "シナリオテンプレ", "シナリオテンプレート", "テンプレ", "剧本", "剧本大纲", "劇本", "劇本大綱", "场景", "场景大纲", "場景", "場景大綱", "背景", "배경", "시나리오", "시나리오 개요"]
9
- k[:examples] = Set.new ["Atburðarásir", "Beispiele", "Beispiller", "Cenarios", "Cenários", "Conto", "Contoh", "Contone", "Dead men tell no tales", "Dæmi", "Dữ liệu", "EXAMPLZ", "Egzanp", "Ejemplos", "Eksempler", "Ekzemploj", "Enghreifftiau", "Esempi", "Examples", "Exempel", "Exemple", "Exemples", "Exemplos", "Juhtumid", "Paraugs", "Pavyzdžiai", "Piemēri", "Primeri", "Primjeri", "Przykłady", "Príklady", "Példák", "Příklady", "Scenarijai", "Scenariji", "Scenarios", "Se the", "Se ðe", "Se þe", "Tapaukset", "Variantai", "Voorbeelde", "Voorbeelden", "You'll wanna", "ghantoH", "lutmey", "Örnekler", "Παραδείγματα", "Σενάρια", "Мисаллар", "Мисоллар", "Приклади", "Примери", "Примеры", "Сценарији", "Үрнәкләр", "דוגמאות", "امثلة", "مثالیں", "نمونه ها", "उदाहरण", "ਉਦਾਹਰਨਾਂ", "ఉదాహరణలు", "ಉದಾಹರಣೆಗಳು", "ชุดของตัวอย่าง", "ชุดของเหตุการณ์", "サンプル", "例", "例子", "예"]
10
- k[:step] = Set.new ["'a", "'ach", "'ej", "*", "7", "A", "A taktiež", "A také", "A tiež", "A zároveň", "AN", "Aber", "Ac", "Adott", "Ak", "Akkor", "Ale", "Aleshores", "Ali", "Allora", "Alors", "Als", "Ama", "Amennyiben", "Amikor", "Ampak", "An", "Ananging", "And", "And y'all", "Angenommen", "Anrhegedig a", "Apabila", "Atesa", "Atunci", "Atès", "Avast!", "Aye", "BUT", "Bagi", "Banjur", "Bet", "Biết", "Blimey!", "Buh", "But", "But at the end of the day I reckon", "But y'all", "Cal", "Cand", "Cando", "Ce", "Cho", "Cuando", "Când", "DEN", "DaH ghu' bejlu'", "Dada", "Dadas", "Dado", "Dados", "Dan", "Dann", "Dano", "Dar", "Dat fiind", "Data", "Date", "Date fiind", "Dati", "Dati fiind", "Dato", "Daţi fiind", "Dați fiind", "De", "Den youse gotta", "Dengan", "Diberi", "Diyelim ki", "Do", "Donada", "Donat", "Donitaĵo", "Dun", "Duota", "E", "Eeldades", "Ef", "En", "Entao", "Entonces", "Então", "Entón", "Epi", "Et", "Etant donné", "Etant donnée", "Etant données", "Etant donnés", "Eğer ki", "Fakat", "Gangway!", "Gdy", "Gegeben sei", "Gegeben seien", "Gegeven", "Gegewe", "Gitt", "Given", "Given y'all", "Givet", "Givun", "Ha", "I", "I CAN HAZ", "In", "Ir", "It's just unbelievable", "Ja", "Jeśli", "Jeżeli", "Kad", "Kada", "Kadar", "Kai", "Kaj", "Když", "Kemudian", "Ketika", "Keď", "Khi", "Kiedy", "Ko", "Kui", "Kuid", "Kun", "Lan", "Le", "Le sa a", "Let go and haul", "Logo", "Lorsqu'<", "Lorsque", "Lè", "Lè sa a", "Ma", "Maar", "Mais", "Majd", "Mając", "Maka", "Manawa", "Mas", "Men", "Menawa", "Mutta", "Nalika", "Nalikaning", "Nanging", "Nato", "Nhưng", "Niin", "Njuk", "När", "Når", "O zaman", "Och", "Og", "Oletetaan", "Ond", "Onda", "Oraz", "Pak", "Pero", "Però", "Podano", "Pokiaľ", "Pokud", "Potem", "Potom", "Privzeto", "Pryd", "Quan", "Quand", "Quando", "Se", "Sed", "Si", "Siis", "Sipoze", "Sipoze Ke", "Sipoze ke", "Soit", "Stel", "Så", "Tad", "Tada", "Tak", "Takrat", "Tapi", "Ter", "Tetapi", "Tha", "Tha the", "Then", "Then y'all", "Thurh", "Thì", "Toda", "Too right", "Un", "Und", "Ve", "Vendar", "Và", "WEN", "Wanneer", "Wenn", "When", "When y'all", "Wtedy", "Wun", "Y", "Y'know", "Yeah nah", "Yna", "Youse know like when", "Youse know when youse got", "Za predpokladu", "Za předpokladu", "Zadan", "Zadani", "Zadano", "Zadate", "Zadato", "Zakładając", "Zaradi", "Zatati", "a", "an", "awer", "dann", "ghu' noblu'", "latlh", "mä", "qaSDI'", "ugeholl", "vaj", "wann", "És", "Étant donné", "Étant donnée", "Étant données", "Étant donnés", "Ða", "Ða ðe", "Ðurh", "Þa", "Þa þe", "Þegar", "Þurh", "Þá", "Če", "Şi", "Și", "Όταν", "Αλλά", "Δεδομένου", "Και", "Τότε", "І", "А", "А також", "Агар", "Але", "Али", "Аммо", "Бирок", "Ва", "Вә", "Дадено", "Дано", "Допустим", "Если", "Задате", "Задати", "Задато", "И", "К тому же", "Кад", "Када", "Когато", "Когда", "Коли", "Лекин", "Ләкин", "Нехай", "Но", "Нәтиҗәдә", "Онда", "Припустимо", "Припустимо, що", "Пусть", "Та", "Также", "То", "Тогда", "Тоді", "Унда", "Якщо", "Һәм", "Әгәр", "Әйтик", "Әмма", "אבל", "אז", "אזי", "בהינתן", "וגם", "כאשר", "آنگاه", "اذاً", "اما", "اور", "اگر", "با فرض", "بالفرض", "بفرض", "تب", "ثم", "جب", "عندما", "فرض کیا", "لكن", "لیکن", "متى", "هنگامی", "و", "پھر", "अगर", "और", "कदा", "किन्तु", "चूंकि", "जब", "तथा", "तदा", "तब", "पर", "परन्तु", "यदि", "ਅਤੇ", "ਜਦੋਂ", "ਜਿਵੇਂ ਕਿ", "ਜੇਕਰ", "ਤਦ", "ਪਰ", "అప్పుడు", "ఈ పరిస్థితిలో", "కాని", "చెప్పబడినది", "మరియు", "ಆದರೆ", "ನಂತರ", "ನೀಡಿದ", "ಮತ್ತು", "ಸ್ಥಿತಿಯನ್ನು", "กำหนดให้", "ดังนั้น", "เมื่อ", "แต่", "และ", "かつ<", "しかし<", "ただし<", "ならば<", "もし<", "並且<", "但し<", "但是<", "假如<", "假定<", "假設<", "假设<", "前提<", "同时<", "同時<", "并且<", "当<", "當<", "而且<", "那么<", "那麼<", "그러면<", "그리고<", "단<", "만약<", "만일<", "먼저<", "조건<", "하지만<"]
7
+ k[:feature] = Set.new ["Ability", "Ahoy matey!", "Arwedd", "Aspekt", "Besigheid Behoefte", "Biznis potreba", "Business Need", "Caracteristica", "Característica", "Carauterística", "Egenskab", "Egenskap", "Eiginleiki", "Feature", "Fitur", "Fonctionnalité", "Fonksyonalite", "Funcionalidade", "Funcionalitat", "Functionalitate", "Functionaliteit", "Funcţionalitate", "Funcționalitate", "Fungsi", "Funkcia", "Funkcija", "Funkcionalitāte", "Funkcionalnost", "Funkcja", "Funksie", "Funktionalität", "Funktionalitéit", "Funzionalità", "Fīča", "Gné", "Hwaet", "Hwæt", "Jellemző", "Karakteristik", "Karakteristika", "Lastnost", "Mak", "Mogucnost", "Mogućnost", "Mozhnost", "Moznosti", "Možnosti", "OH HAI", "Omadus", "Ominaisuus", "Osobina", "Potrzeba biznesowa", "Požadavek", "Požiadavka", "Pretty much", "Qap", "Qu'meH 'ut", "Savybė", "Trajto", "Tính năng", "Vermoë", "Vlastnosť", "Właściwość", "Značilnost", "laH", "perbogh", "poQbogh malja'", "Özellik", "Özəllik", "Δυνατότητα", "Λειτουργία", "Бизнис потреба", "Могућност", "Можност", "Мөмкинлек", "Особина", "Свойство", "Функц", "Функционал", "Функционалност", "Функциональность", "Функция", "Функціонал", "Үзенчәлеклелек", "Հատկություն", "Ֆունկցիոնալություն", "תכונה", "خاصية", "خصوصیت", "صلاحیت", "وِیژگی", "کاروبار کی ضرورت", "रूप लेख", "ਖਾਸੀਅਤ", "ਨਕਸ਼ ਨੁਹਾਰ", "ਮੁਹਾਂਦਰਾ", "ક્ષમતા", "લક્ષણ", "વ્યાપાર જરૂર", "அம்சம்", "திறன்", "வணிக தேவை", "గుణము", "ಹೆಚ್ಚಳ", "ความต้องการทางธุรกิจ", "ความสามารถ", "โครงหลัก", "თვისება", "フィーチャ", "功能", "機能", "기능", "📚"]
8
+ k[:element] = Set.new ["Abstract Scenario", "Abstrakt Scenario", "Achtergrond", "Aer", "Agtergrond", "Antecedentes", "Antecedents", "Atburðarás", "Awww, look mate", "B4", "Background", "Baggrund", "Bakgrund", "Bakgrunn", "Bakgrunnur", "Bối cảnh", "Casu", "Cefndir", "Cenario", "Cenario de Fundo", "Cenário", "Cenário de Fundo", "Contesto", "Context", "Contexte", "Contexto", "Cás", "Cás Achomair", "Cúlra", "Dasar", "Delineacao do Cenario", "Delineação do Cenário", "Dis is what went down", "Dyagram Senaryo", "Dyagram senaryo", "Esbozo do escenario", "Esbozu del casu", "Escenari", "Escenario", "Esquema de l'escenari", "Esquema del escenario", "Esquema do Cenario", "Esquema do Cenário", "First off", "Fono", "Forgatókönyv", "Forgatókönyv vázlat", "Fundo", "Garis Panduan Senario", "Geçmiş", "Grundlage", "Hannergrond", "Heave to", "Háttér", "Istorik", "Kazo", "Kazo-skizo", "Keadaan", "Kerangka Keadaan", "Kerangka Senario", "Kerangka Situasi", "Keçmiş", "Khung kịch bản", "Khung tình huống", "Koncept", "Konsep skenario", "Kontekst", "Kontekstas", "Konteksts", "Kontext", "Konturo de la scenaro", "Kontèks", "Kịch bản", "Latar Belakang", "Lýsing Atburðarásar", "Lýsing Dæma", "MISHUN", "MISHUN SRSLY", "Na primer", "Náčrt Scenára", "Náčrt Scenáru", "Náčrt Scénáře", "Oris scenarija", "Osnova", "Osnova Scenára", "Osnova scénáře", "Osnutek", "Ozadje", "Plan Senaryo", "Plan du Scénario", "Plan du scénario", "Plan senaryo", "Plang vum Szenario", "Pozadie", "Pozadina", "Pozadí", "Pregled na scenarija", "Primer", "Raamstsenaarium", "Reckon it's like", "Rerefons", "Scenarie", "Scenarij", "Scenarijaus šablonas", "Scenariju", "Scenariju-obris", "Scenarijus", "Scenario", "Scenario Amlinellol", "Scenario Outline", "Scenario Template", "Scenario-outline", "Scenariomal", "Scenariomall", "Scenariu", "Scenariusz", "Scenaro", "Scenár", "Scenārijs", "Scenārijs pēc parauga", "Schema dello scenario", "Scénario", "Scénář", "Senario", "Senaryo", "Senaryo Deskripsyon", "Senaryo deskripsyon", "Senaryo taslağı", "Shiver me timbers", "Situasi", "Situasie", "Situasie Uiteensetting", "Situācija", "Skenario", "Skenario konsep", "Skica", "Skizo", "Sodrzhina", "Ssenari", "Ssenarinin strukturu", "Structura scenariu", "Structură scenariu", "Struktura scenarija", "Stsenaarium", "Swa", "Swa hwaer swa", "Swa hwær swa", "Szablon scenariusza", "Szenario", "Szenariogrundriss", "Tapaus", "Tapausaihio", "Taust", "Tausta", "The thing of it is", "Tình huống", "Wharrimean is", "Yo-ho-ho", "Założenia", "lut", "lut chovnatlh", "mo'", "Ær", "Περιγραφή Σεναρίου", "Σενάριο", "Υπόβαθρο", "Агуулга", "Кереш", "Контекст", "Концепт", "На пример", "Основа", "Передумова", "Позадина", "Преглед на сценарија", "Предистория", "Предыстория", "Пример", "Рамка на сценарий", "Скица", "Содржина", "Структура сценария", "Структура сценарија", "Структура сценарію", "Сценар", "Сценарий", "Сценарий структураси", "Сценарийның төзелеше", "Сценарио", "Сценарын төлөвлөгөө", "Сценарій", "Тарих", "Կոնտեքստ", "Սցենար", "Սցենարի կառուցվացքը", "רקע", "תבנית תרחיש", "תרחיש", "الخلفية", "الگوی سناریو", "زمینه", "سناریو", "سيناريو", "سيناريو مخطط", "منظر نامے کا خاکہ", "منظرنامہ", "پس منظر", "परिदृश्य", "परिदृश्य रूपरेखा", "पृष्ठभूमि", "ਪਟਕਥਾ", "ਪਟਕਥਾ ਢਾਂਚਾ", "ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ", "ਪਿਛੋਕੜ", "પરિદ્દશ્ય ઢાંચો", "પરિદ્દશ્ય રૂપરેખા", "બેકગ્રાઉન્ડ", "સ્થિતિ", "காட்சி", "காட்சி சுருக்கம்", "காட்சி வார்ப்புரு", "பின்னணி", "కథనం", "నేపథ్యం", "సన్నివేశం", "ಕಥಾಸಾರಾಂಶ", "ವಿವರಣೆ", "ಹಿನ್ನೆಲೆ", "สรุปเหตุการณ์", "เหตุการณ์", "แนวคิด", "โครงสร้างของเหตุการณ์", "კონტექსტი", "სცენარის", "სცენარის ნიმუში", "シナリオ", "シナリオアウトライン", "シナリオテンプレ", "シナリオテンプレート", "テンプレ", "剧本", "剧本大纲", "劇本", "劇本大綱", "场景", "场景大纲", "場景", "場景大綱", "背景", "배경", "시나리오", "시나리오 개요", "💤", "📕", "📖"]
9
+ k[:examples] = Set.new [" நிலைமைகளில்", "Atburðarásir", "Beispiele", "Beispiller", "Cenarios", "Cenários", "Conto", "Contoh", "Contone", "Dead men tell no tales", "Dæmi", "Dữ liệu", "EXAMPLZ", "Egzanp", "Ejemplos", "Eksempler", "Ekzemploj", "Enghreifftiau", "Esempi", "Examples", "Exempel", "Exemple", "Exemples", "Exemplos", "Juhtumid", "Nümunələr", "Paraugs", "Pavyzdžiai", "Piemēri", "Primeri", "Primjeri", "Przykłady", "Príklady", "Példák", "Příklady", "Samplaí", "Scenaria", "Scenarijai", "Scenariji", "Scenarios", "Se the", "Se ðe", "Se þe", "Tapaukset", "Variantai", "Voorbeelde", "Voorbeelden", "You'll wanna", "ghantoH", "lutmey", "Örnekler", "Παραδείγματα", "Σενάρια", "Мисаллар", "Мисоллар", "Приклади", "Примери", "Примеры", "Сценарија", "Сценарији", "Тухайлбал", "Үрнәкләр", "Օրինակներ", "דוגמאות", "امثلة", "مثالیں", "نمونه ها", "उदाहरण", "ਉਦਾਹਰਨਾਂ", "ઉદાહરણો", "எடுத்துக்காட்டுகள்", "காட்சிகள்", "ఉదాహరణలు", "ಉದಾಹರಣೆಗಳು", "ชุดของตัวอย่าง", "ชุดของเหตุการณ์", "მაგალითები", "サンプル", "例", "例子", "예", "📓"]
10
+ k[:step] = Set.new ["'a ", "'ach ", "'ej ", "* ", "7 ", "A ", "A taktiež ", "A také ", "A tiež ", "A zároveň ", "AN ", "Aber ", "Ac ", "Ach", "Adott ", "Agus", "Ak ", "Akkor ", "Ale ", "Aleshores ", "Ali ", "Allora ", "Alors ", "Als ", "Ama ", "Amennyiben ", "Amikor ", "Amma ", "Ampak ", "An ", "Ananging ", "Ancaq ", "And ", "Angenommen ", "Anrhegedig a ", "Ansin", "Apabila ", "Atesa ", "Atunci ", "Atès ", "Avast! ", "Aye ", "BUT ", "Bagi ", "Banjur ", "Bet ", "Biết ", "Blimey! ", "Buh ", "But ", "But at the end of the day I reckon ", "Cal ", "Cand ", "Cando ", "Ce ", "Cho ", "Cuando ", "Cuir i gcás go", "Cuir i gcás gur", "Cuir i gcás nach", "Cuir i gcás nár", "Când ", "DEN ", "DaH ghu' bejlu' ", "Dada ", "Dadas ", "Dadena ", "Dadeno ", "Dado ", "Dados ", "Daes ", "Dan ", "Dann ", "Dano ", "Daos ", "Dar ", "Dat fiind ", "Data ", "Date ", "Date fiind ", "Dati ", "Dati fiind ", "Dato ", "Daţi fiind ", "Dați fiind ", "De ", "Den youse gotta ", "Dengan ", "Diberi ", "Diyelim ki ", "Do ", "Donada ", "Donat ", "Donitaĵo ", "Dun ", "Duota ", "Dáu ", "E ", "Eeldades ", "Ef ", "En ", "Entao ", "Entonces ", "Então ", "Entón ", "Entós ", "Epi ", "Et ", "Et qu'", "Et que ", "Etant donné ", "Etant donné qu'", "Etant donné que ", "Etant donnée ", "Etant données ", "Etant donnés ", "Eğer ki ", "Fakat ", "Gangway! ", "Gdy ", "Gegeben sei ", "Gegeben seien ", "Gegeven ", "Gegewe ", "Gitt ", "Given ", "Givet ", "Givun ", "Ha ", "Həm ", "I ", "I CAN HAZ ", "In ", "Ir ", "It's just unbelievable ", "Ja ", "Jeśli ", "Jeżeli ", "Kad ", "Kada ", "Kadar ", "Kai ", "Kaj ", "Když ", "Kemudian ", "Ketika ", "Keď ", "Khi ", "Kiedy ", "Ko ", "Koga ", "Komence ", "Kui ", "Kuid ", "Kun ", "Lan ", "Le ", "Le sa a ", "Let go and haul ", "Logo ", "Lorsqu'", "Lorsque ", "Lè ", "Lè sa a ", "Ma ", "Maar ", "Mais ", "Mais qu'", "Mais que ", "Majd ", "Mając ", "Maka ", "Manawa ", "Mas ", "Men ", "Menawa ", "Mutta ", "Nalika ", "Nalikaning ", "Nanging ", "Nato ", "Nhưng ", "Niin ", "Njuk ", "No ", "Nuair a", "Nuair ba", "Nuair nach", "Nuair nár", "När ", "Når ", "Nə vaxt ki ", "O halda ", "O zaman ", "Och ", "Og ", "Oletetaan ", "Ond ", "Onda ", "Oraz ", "Pak ", "Pero ", "Peru ", "Però ", "Podano ", "Pokiaľ ", "Pokud ", "Potem ", "Potom ", "Privzeto ", "Pryd ", "Quan ", "Quand ", "Quando ", "Se ", "Sed ", "Si ", "Siis ", "Sipoze ", "Sipoze Ke ", "Sipoze ke ", "Soit ", "Stel ", "Så ", "Tad ", "Tada ", "Tak ", "Takrat ", "Tapi ", "Ter ", "Tetapi ", "Tha ", "Tha the ", "Then ", "Thurh ", "Thì ", "Toda ", "Togash ", "Too right ", "Tutaq ki ", "Un ", "Und ", "Ve ", "Vendar ", "Verilir ", " ", "Və ", "WEN ", "Wanneer ", "Wenn ", "When ", "Wtedy ", "Wun ", "Y ", "Y'know ", "Ya ", "Yeah nah ", "Yna ", "Youse know like when ", "Youse know when youse got ", "Za date ", "Za dati ", "Za dato ", "Za predpokladu ", "Za předpokladu ", "Zadan ", "Zadani ", "Zadano ", "Zakładając ", "Zakładając, że ", "Zaradi ", "Zatim ", "a ", "an ", "awer ", "dann ", "ghu' noblu' ", "latlh ", "mä ", "qaSDI' ", "ugeholl ", "vaj ", "wann ", "És ", "Étant donné ", "Étant donné qu'", "Étant donné que ", "Étant donnée ", "Étant données ", "Étant donnés ", "Ða ", "Ða ðe ", "Ðurh ", "Þa ", "Þa þe ", "Þegar ", "Þurh ", "Þá ", "Če ", "Şi ", "Əgər ", "Și ", "Όταν ", "Αλλά ", "Δεδομένου ", "Και ", "Τότε ", "І ", "А ", "А також ", "Агар ", "Але ", "Али ", "Аммо ", "Анх ", "Бирок ", "Ва ", "Вә ", "Гэхдээ ", "Дадена ", "Дадено ", "Дано ", "Допустим ", "Если ", "За дате ", "За дати ", "За дато ", "Затем ", "И ", "К тому же ", "Кад ", "Када ", "Кога ", "Когато ", "Когда ", "Коли ", "Лекин ", "Ләкин ", "Мөн ", "Нехай ", "Но ", "Нәтиҗәдә ", "Онда ", "Припустимо ", "Припустимо, що ", "Пусть ", "Та ", "Также ", "То ", "Тогаш ", "Тогда ", "Тоді ", "Тэгэхэд ", "Тэгээд ", "Унда ", "Харин ", "Хэрэв ", "Якщо ", "Үүний дараа ", "Һәм ", "Әгәр ", "Әйтик ", "Әмма ", "Өгөгдсөн нь ", "Ապա ", "Բայց ", "Դիցուք ", "Եթե ", "Եվ ", "Երբ ", "אבל ", "אז ", "אזי ", "בהינתן ", "וגם ", "כאשר ", "آنگاه ", "اذاً ", "اما ", "اور ", "اگر ", "با فرض ", "بالفرض ", "بفرض ", "تب ", "ثم ", "جب ", "عندما ", "فرض کیا ", "لكن ", "لیکن ", "متى ", "هنگامی ", "و ", "پھر ", "अगर ", "और ", "कदा ", "किन्तु ", "चूंकि ", "जब ", "तथा ", "तदा ", "तब ", "पर ", "परन्तु ", "यदि ", "ਅਤੇ ", "ਜਦੋਂ ", "ਜਿਵੇਂ ਕਿ ", "ਜੇਕਰ ", "ਤਦ ", "ਪਰ ", "અને ", "આપેલ છે ", "ક્યારે ", "પછી ", "પણ ", "அப்பொழுது ", "ஆனால் ", "எப்போது ", "கொடுக்கப்பட்ட ", "மற்றும் ", "மேலும் ", "అప్పుడు ", "ఈ పరిస్థితిలో ", "కాని ", "చెప్పబడినది ", "మరియు ", "ಆದರೆ ", "ನಂತರ ", "ನೀಡಿದ ", "ಮತ್ತು ", "ಸ್ಥಿತಿಯನ್ನು ", "กำหนดให้ ", "ดังนั้น ", "เมื่อ ", "แต่ ", "และ ", "და", "მაგ­რამ", "მაშინ", "მოცემული", "როდესაც", "かつ", "しかし", "ただし", "ならば", "もし", "並且", "但し", "但是", "假如", "假定", "假設", "假设", "前提", "同时", "同時", "并且", "", "", "而且", "那么", "那麼", "그러면", "그리고", "", "만약", "만일", "먼저", "조건", "하지만", "🎬", "😂", "😐", "😔", "🙏"]
11
11
  end
12
12
  end
13
13
  end
@@ -0,0 +1,243 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class GraphQL < RegexLexer
6
+ desc 'GraphQL'
7
+ tag 'graphql'
8
+ filenames '*.graphql', '*.gql'
9
+ mimetypes 'application/graphql'
10
+
11
+ name = /[_A-Za-z][_0-9A-Za-z]*/
12
+
13
+ state :root do
14
+ rule /\b(?:query|mutation|subscription)\b/, Keyword, :query_definition
15
+ rule /\{/ do
16
+ token Punctuation
17
+ push :query_definition
18
+ push :selection_set
19
+ end
20
+
21
+ rule /\bfragment\b/, Keyword, :fragment_definition
22
+
23
+ rule /\b(?:type|interface|enum)\b/, Keyword, :type_definition
24
+ rule /\b(?:input|schema)\b/, Keyword, :type_definition
25
+
26
+ rule /\bunion\b/, Keyword, :union_definition
27
+
28
+ mixin :basic
29
+ end
30
+
31
+ state :basic do
32
+ rule /\s+/m, Text::Whitespace
33
+ rule /#.*$/, Comment
34
+
35
+ rule /[!,]/, Punctuation
36
+ end
37
+
38
+ state :has_directives do
39
+ rule /(@#{name})(\s*)(\()/ do
40
+ groups Keyword, Text::Whitespace, Punctuation
41
+ push :arguments
42
+ end
43
+ rule /@#{name}\b/, Keyword
44
+ end
45
+
46
+ state :fragment_definition do
47
+ rule /\bon\b/, Keyword
48
+
49
+ mixin :query_definition
50
+ end
51
+
52
+ state :query_definition do
53
+ mixin :has_directives
54
+
55
+ rule /\b#{name}\b/, Name
56
+ rule /\(/, Punctuation, :variable_definitions
57
+ rule /\{/, Punctuation, :selection_set
58
+
59
+ mixin :basic
60
+ end
61
+
62
+ state :type_definition do
63
+ rule /\bimplements\b/, Keyword
64
+ rule /\b#{name}\b/, Name
65
+ rule /\(/, Punctuation, :variable_definitions
66
+ rule /\{/, Punctuation, :type_definition_set
67
+
68
+ mixin :basic
69
+ end
70
+
71
+ state :union_definition do
72
+ rule /\b#{name}\b/, Name
73
+ rule /\=/, Punctuation, :union_definition_variant
74
+
75
+ mixin :basic
76
+ end
77
+
78
+ state :union_definition_variant do
79
+ rule /\b#{name}\b/ do
80
+ token Name
81
+ pop!
82
+ push :union_definition_pipe
83
+ end
84
+
85
+ mixin :basic
86
+ end
87
+
88
+ state :union_definition_pipe do
89
+ rule /\|/ do
90
+ token Punctuation
91
+ pop!
92
+ push :union_definition_variant
93
+ end
94
+
95
+ rule /(?!\||\s+|#[^\n]*)/ do
96
+ pop! 2
97
+ end
98
+
99
+ mixin :basic
100
+ end
101
+
102
+ state :type_definition_set do
103
+ rule /\}/ do
104
+ token Punctuation
105
+ pop! 2
106
+ end
107
+
108
+ rule /\b(#{name})(\s*)(\()/ do
109
+ groups Name, Text::Whitespace, Punctuation
110
+ push :variable_definitions
111
+ end
112
+ rule /\b#{name}\b/, Name
113
+
114
+ rule /:/, Punctuation, :type_names
115
+
116
+ mixin :basic
117
+ end
118
+
119
+ state :arguments do
120
+ rule /\)/ do
121
+ token Punctuation
122
+ pop!
123
+ end
124
+
125
+ rule /\b#{name}\b/, Name
126
+ rule /:/, Punctuation, :value
127
+
128
+ mixin :basic
129
+ end
130
+
131
+ state :variable_definitions do
132
+ rule /\)/ do
133
+ token Punctuation
134
+ pop!
135
+ end
136
+
137
+ rule /\$#{name}\b/, Name::Variable
138
+ rule /\b#{name}\b/, Name
139
+ rule /:/, Punctuation, :type_names
140
+ rule /\=/, Punctuation, :value
141
+
142
+ mixin :basic
143
+ end
144
+
145
+ state :type_names do
146
+ rule /\b(?:Int|Float|String|Boolean|ID)\b/, Name::Builtin, :pop!
147
+ rule /\b#{name}\b/, Name, :pop!
148
+
149
+ rule /\[/, Punctuation, :type_name_list
150
+
151
+ mixin :basic
152
+ end
153
+
154
+ state :type_name_list do
155
+ rule /\b(?:Int|Float|String|Boolean|ID)\b/, Name::Builtin
156
+ rule /\b#{name}\b/, Name
157
+
158
+ rule /\]/ do
159
+ token Punctuation
160
+ pop! 2
161
+ end
162
+
163
+ mixin :basic
164
+ end
165
+
166
+ state :selection_set do
167
+ mixin :has_directives
168
+
169
+ rule /\}/ do
170
+ token Punctuation
171
+ pop!
172
+ pop! if state?(:query_definition) || state?(:fragment_definition)
173
+ end
174
+
175
+ rule /\b(#{name})(\s*)(\()/ do
176
+ groups Name, Text::Whitespace, Punctuation
177
+ push :arguments
178
+ end
179
+
180
+ rule /\b(#{name})(\s*)(:)/ do
181
+ groups Name, Text::Whitespace, Punctuation
182
+ end
183
+
184
+ rule /\b#{name}\b/, Name
185
+
186
+ rule /(\.\.\.)(\s+)(on)\b/ do
187
+ groups Punctuation, Text::Whitespace, Keyword
188
+ end
189
+ rule /\.\.\./, Punctuation
190
+
191
+ rule /\{/, Punctuation, :selection_set
192
+
193
+ mixin :basic
194
+ end
195
+
196
+ state :list do
197
+ rule /\]/ do
198
+ token Punctuation
199
+ pop!
200
+ pop! if state?(:value)
201
+ end
202
+
203
+ mixin :value
204
+ end
205
+
206
+ state :object do
207
+ rule /\}/ do
208
+ token Punctuation
209
+ pop!
210
+ pop! if state?(:value)
211
+ end
212
+
213
+ rule /\b(#{name})(\s*)(:)/ do
214
+ groups Name, Text::Whitespace, Punctuation
215
+ push :value
216
+ end
217
+
218
+ mixin :basic
219
+ end
220
+
221
+ state :value do
222
+ pop_unless_list = ->(t) {
223
+ ->(m) {
224
+ token t
225
+ pop! unless state?(:list)
226
+ }
227
+ }
228
+
229
+ rule /\$#{name}\b/, &pop_unless_list[Name::Variable]
230
+ rule /\b(?:true|false|null)\b/, &pop_unless_list[Keyword::Constant]
231
+ rule /[+-]?[0-9]+\.[0-9]+(?:[eE][+-]?[0-9]+)?/, &pop_unless_list[Num::Float]
232
+ rule /[+-]?[1-9][0-9]*(?:[eE][+-]?[0-9]+)?/, &pop_unless_list[Num::Integer]
233
+ rule /"(\\[\\"]|[^"])*"/, &pop_unless_list[Str::Double]
234
+ rule /\b#{name}\b/, &pop_unless_list[Name]
235
+
236
+ rule /\{/, Punctuation, :object
237
+ rule /\[/, Punctuation, :list
238
+
239
+ mixin :basic
240
+ end
241
+ end
242
+ end
243
+ end
@@ -6,11 +6,15 @@ module Rouge
6
6
  title "Groovy"
7
7
  desc 'The Groovy programming language (http://www.groovy-lang.org/)'
8
8
  tag 'groovy'
9
- filenames '*.groovy'
9
+ filenames '*.groovy', 'Jenkinsfile'
10
10
  mimetypes 'text/x-groovy'
11
11
 
12
12
  ws = %r((?:\s|//.*?\n|/[*].*?[*]/)+)
13
13
 
14
+ def self.analyze_text(text)
15
+ return 1 if text.shebang?(/groovy/)
16
+ end
17
+
14
18
  def self.keywords
15
19
  @keywords ||= Set.new %w(
16
20
  assert break case catch continue default do else finally for
@@ -20,29 +20,38 @@ module Rouge
20
20
  return 0.1 if text.start_with? '!!!'
21
21
  end
22
22
 
23
+ option 'filters[filter_name]', 'Mapping of lexers to use for haml :filters'
24
+ attr_reader :filters
23
25
  # @option opts :filters
24
26
  # A hash of filter name to lexer of how various filters should be
25
27
  # highlighted. By default, :javascript, :css, :ruby, and :erb
26
28
  # are supported.
27
29
  def initialize(opts={})
28
- (opts.delete(:filters) || {}).each do |name, lexer|
29
- unless lexer.respond_to? :lex
30
- lexer = Lexer.find(lexer) or raise "unknown lexer: #{lexer}"
31
- lexer = lexer.new(options)
32
- end
30
+ super
33
31
 
34
- self.filters[name.to_s] = lexer
35
- end
32
+ default_filters = {
33
+ 'javascript' => Javascript.new(options),
34
+ 'css' => CSS.new(options),
35
+ 'ruby' => ruby,
36
+ 'erb' => ERB.new(options),
37
+ 'markdown' => Markdown.new(options),
38
+ 'sass' => Sass.new(options),
39
+ # TODO
40
+ # 'textile' => Textile.new(options),
41
+ # 'maruku' => Maruku.new(options),
42
+ }
36
43
 
37
- super(opts)
44
+ @filters = hash_option(:filters, default_filters) do |v|
45
+ as_lexer(v) || PlainText.new(@options)
46
+ end
38
47
  end
39
48
 
40
49
  def ruby
41
- @ruby ||= Ruby.new(options)
50
+ @ruby ||= Ruby.new(@options)
42
51
  end
43
52
 
44
53
  def html
45
- @html ||= HTML.new(options)
54
+ @html ||= HTML.new(@options)
46
55
  end
47
56
 
48
57
  def ruby!(state)
@@ -50,20 +59,6 @@ module Rouge
50
59
  push state
51
60
  end
52
61
 
53
- def filters
54
- @filters ||= {
55
- 'javascript' => Javascript.new(options),
56
- 'css' => CSS.new(options),
57
- 'ruby' => ruby,
58
- 'erb' => ERB.new(options),
59
- 'markdown' => Markdown.new(options),
60
- # TODO
61
- # 'sass' => Sass.new(options),
62
- # 'textile' => Textile.new(options),
63
- # 'maruku' => Maruku.new(options),
64
- }
65
- end
66
-
67
62
  start { ruby.reset!; html.reset! }
68
63
 
69
64
  identifier = /[\w:-]+/