gitlab-rouge 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +23 -0
- data/LICENSE +186 -0
- data/bin/rougify +16 -0
- data/gitlab-rouge.gemspec +17 -0
- data/lib/rouge.rb +57 -0
- data/lib/rouge/cli.rb +363 -0
- data/lib/rouge/demos/apache +21 -0
- data/lib/rouge/demos/applescript +2 -0
- data/lib/rouge/demos/c +8 -0
- data/lib/rouge/demos/clojure +5 -0
- data/lib/rouge/demos/coffeescript +5 -0
- data/lib/rouge/demos/common_lisp +1 -0
- data/lib/rouge/demos/conf +4 -0
- data/lib/rouge/demos/cpp +8 -0
- data/lib/rouge/demos/csharp +5 -0
- data/lib/rouge/demos/css +4 -0
- data/lib/rouge/demos/dart +6 -0
- data/lib/rouge/demos/diff +7 -0
- data/lib/rouge/demos/elixir +1 -0
- data/lib/rouge/demos/erb +1 -0
- data/lib/rouge/demos/erlang +7 -0
- data/lib/rouge/demos/factor +5 -0
- data/lib/rouge/demos/gherkin +17 -0
- data/lib/rouge/demos/glsl +14 -0
- data/lib/rouge/demos/go +7 -0
- data/lib/rouge/demos/groovy +9 -0
- data/lib/rouge/demos/haml +5 -0
- data/lib/rouge/demos/handlebars +7 -0
- data/lib/rouge/demos/haskell +6 -0
- data/lib/rouge/demos/html +8 -0
- data/lib/rouge/demos/http +14 -0
- data/lib/rouge/demos/ini +4 -0
- data/lib/rouge/demos/io +11 -0
- data/lib/rouge/demos/java +5 -0
- data/lib/rouge/demos/javascript +1 -0
- data/lib/rouge/demos/json +1 -0
- data/lib/rouge/demos/json-doc +1 -0
- data/lib/rouge/demos/liquid +11 -0
- data/lib/rouge/demos/literate_coffeescript +3 -0
- data/lib/rouge/demos/literate_haskell +7 -0
- data/lib/rouge/demos/llvm +20 -0
- data/lib/rouge/demos/lua +12 -0
- data/lib/rouge/demos/make +6 -0
- data/lib/rouge/demos/markdown +4 -0
- data/lib/rouge/demos/matlab +6 -0
- data/lib/rouge/demos/moonscript +16 -0
- data/lib/rouge/demos/nginx +5 -0
- data/lib/rouge/demos/nim +27 -0
- data/lib/rouge/demos/objective_c +14 -0
- data/lib/rouge/demos/ocaml +12 -0
- data/lib/rouge/demos/perl +5 -0
- data/lib/rouge/demos/php +3 -0
- data/lib/rouge/demos/plaintext +1 -0
- data/lib/rouge/demos/powershell +49 -0
- data/lib/rouge/demos/prolog +9 -0
- data/lib/rouge/demos/properties +7 -0
- data/lib/rouge/demos/puppet +6 -0
- data/lib/rouge/demos/python +6 -0
- data/lib/rouge/demos/qml +9 -0
- data/lib/rouge/demos/r +8 -0
- data/lib/rouge/demos/racket +24 -0
- data/lib/rouge/demos/ruby +9 -0
- data/lib/rouge/demos/rust +12 -0
- data/lib/rouge/demos/sass +3 -0
- data/lib/rouge/demos/scala +3 -0
- data/lib/rouge/demos/scheme +4 -0
- data/lib/rouge/demos/scss +5 -0
- data/lib/rouge/demos/sed +4 -0
- data/lib/rouge/demos/shell +2 -0
- data/lib/rouge/demos/slim +17 -0
- data/lib/rouge/demos/smalltalk +6 -0
- data/lib/rouge/demos/sml +4 -0
- data/lib/rouge/demos/sql +1 -0
- data/lib/rouge/demos/swift +5 -0
- data/lib/rouge/demos/tcl +1 -0
- data/lib/rouge/demos/tex +1 -0
- data/lib/rouge/demos/toml +9 -0
- data/lib/rouge/demos/tulip +14 -0
- data/lib/rouge/demos/vb +4 -0
- data/lib/rouge/demos/viml +5 -0
- data/lib/rouge/demos/xml +2 -0
- data/lib/rouge/demos/yaml +4 -0
- data/lib/rouge/formatter.rb +50 -0
- data/lib/rouge/formatters/html.rb +117 -0
- data/lib/rouge/formatters/null.rb +19 -0
- data/lib/rouge/formatters/terminal256.rb +176 -0
- data/lib/rouge/lexer.rb +443 -0
- data/lib/rouge/lexers/apache.rb +68 -0
- data/lib/rouge/lexers/apache/keywords.yml +453 -0
- data/lib/rouge/lexers/apple_script.rb +367 -0
- data/lib/rouge/lexers/c.rb +212 -0
- data/lib/rouge/lexers/clojure.rb +112 -0
- data/lib/rouge/lexers/coffeescript.rb +174 -0
- data/lib/rouge/lexers/common_lisp.rb +345 -0
- data/lib/rouge/lexers/conf.rb +24 -0
- data/lib/rouge/lexers/cpp.rb +66 -0
- data/lib/rouge/lexers/csharp.rb +88 -0
- data/lib/rouge/lexers/css.rb +271 -0
- data/lib/rouge/lexers/dart.rb +104 -0
- data/lib/rouge/lexers/diff.rb +31 -0
- data/lib/rouge/lexers/elixir.rb +108 -0
- data/lib/rouge/lexers/erb.rb +56 -0
- data/lib/rouge/lexers/erlang.rb +118 -0
- data/lib/rouge/lexers/factor.rb +302 -0
- data/lib/rouge/lexers/gherkin.rb +137 -0
- data/lib/rouge/lexers/gherkin/keywords.rb +14 -0
- data/lib/rouge/lexers/glsl.rb +135 -0
- data/lib/rouge/lexers/go.rb +178 -0
- data/lib/rouge/lexers/groovy.rb +104 -0
- data/lib/rouge/lexers/haml.rb +228 -0
- data/lib/rouge/lexers/handlebars.rb +79 -0
- data/lib/rouge/lexers/haskell.rb +183 -0
- data/lib/rouge/lexers/html.rb +94 -0
- data/lib/rouge/lexers/http.rb +80 -0
- data/lib/rouge/lexers/ini.rb +57 -0
- data/lib/rouge/lexers/io.rb +68 -0
- data/lib/rouge/lexers/java.rb +76 -0
- data/lib/rouge/lexers/javascript.rb +297 -0
- data/lib/rouge/lexers/liquid.rb +287 -0
- data/lib/rouge/lexers/literate_coffeescript.rb +33 -0
- data/lib/rouge/lexers/literate_haskell.rb +36 -0
- data/lib/rouge/lexers/llvm.rb +84 -0
- data/lib/rouge/lexers/lua.rb +122 -0
- data/lib/rouge/lexers/lua/builtins.rb +22 -0
- data/lib/rouge/lexers/make.rb +116 -0
- data/lib/rouge/lexers/markdown.rb +154 -0
- data/lib/rouge/lexers/matlab.rb +74 -0
- data/lib/rouge/lexers/matlab/builtins.rb +11 -0
- data/lib/rouge/lexers/moonscript.rb +110 -0
- data/lib/rouge/lexers/nginx.rb +71 -0
- data/lib/rouge/lexers/nim.rb +152 -0
- data/lib/rouge/lexers/objective_c.rb +197 -0
- data/lib/rouge/lexers/ocaml.rb +111 -0
- data/lib/rouge/lexers/perl.rb +197 -0
- data/lib/rouge/lexers/php.rb +173 -0
- data/lib/rouge/lexers/php/builtins.rb +204 -0
- data/lib/rouge/lexers/plain_text.rb +25 -0
- data/lib/rouge/lexers/powershell.rb +96 -0
- data/lib/rouge/lexers/prolog.rb +64 -0
- data/lib/rouge/lexers/properties.rb +55 -0
- data/lib/rouge/lexers/puppet.rb +128 -0
- data/lib/rouge/lexers/python.rb +228 -0
- data/lib/rouge/lexers/qml.rb +72 -0
- data/lib/rouge/lexers/r.rb +56 -0
- data/lib/rouge/lexers/racket.rb +542 -0
- data/lib/rouge/lexers/ruby.rb +415 -0
- data/lib/rouge/lexers/rust.rb +191 -0
- data/lib/rouge/lexers/sass.rb +74 -0
- data/lib/rouge/lexers/sass/common.rb +180 -0
- data/lib/rouge/lexers/scala.rb +142 -0
- data/lib/rouge/lexers/scheme.rb +112 -0
- data/lib/rouge/lexers/scss.rb +34 -0
- data/lib/rouge/lexers/sed.rb +170 -0
- data/lib/rouge/lexers/shell.rb +152 -0
- data/lib/rouge/lexers/slim.rb +228 -0
- data/lib/rouge/lexers/smalltalk.rb +116 -0
- data/lib/rouge/lexers/sml.rb +347 -0
- data/lib/rouge/lexers/sql.rb +140 -0
- data/lib/rouge/lexers/swift.rb +144 -0
- data/lib/rouge/lexers/tcl.rb +192 -0
- data/lib/rouge/lexers/tex.rb +72 -0
- data/lib/rouge/lexers/toml.rb +71 -0
- data/lib/rouge/lexers/tulip.rb +75 -0
- data/lib/rouge/lexers/vb.rb +164 -0
- data/lib/rouge/lexers/viml.rb +101 -0
- data/lib/rouge/lexers/viml/keywords.rb +12 -0
- data/lib/rouge/lexers/xml.rb +59 -0
- data/lib/rouge/lexers/yaml.rb +364 -0
- data/lib/rouge/plugins/redcarpet.rb +30 -0
- data/lib/rouge/regex_lexer.rb +439 -0
- data/lib/rouge/template_lexer.rb +22 -0
- data/lib/rouge/text_analyzer.rb +48 -0
- data/lib/rouge/theme.rb +195 -0
- data/lib/rouge/themes/base16.rb +130 -0
- data/lib/rouge/themes/colorful.rb +67 -0
- data/lib/rouge/themes/github.rb +71 -0
- data/lib/rouge/themes/molokai.rb +82 -0
- data/lib/rouge/themes/monokai.rb +92 -0
- data/lib/rouge/themes/monokai_sublime.rb +90 -0
- data/lib/rouge/themes/thankful_eyes.rb +71 -0
- data/lib/rouge/token.rb +182 -0
- data/lib/rouge/util.rb +101 -0
- data/lib/rouge/version.rb +7 -0
- metadata +231 -0
@@ -0,0 +1,137 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
module Rouge
|
4
|
+
module Lexers
|
5
|
+
class Gherkin < RegexLexer
|
6
|
+
tag 'gherkin'
|
7
|
+
aliases 'cucumber', 'behat'
|
8
|
+
|
9
|
+
title "Gherkin"
|
10
|
+
desc 'A business-readable spec DSL ( github.com/cucumber/cucumber/wiki/Gherkin )'
|
11
|
+
|
12
|
+
filenames '*.feature'
|
13
|
+
mimetypes 'text/x-gherkin'
|
14
|
+
|
15
|
+
def self.analyze_text(text)
|
16
|
+
return 1 if text.shebang? 'cucumber'
|
17
|
+
end
|
18
|
+
|
19
|
+
# self-modifying method that loads the keywords file
|
20
|
+
def self.keywords
|
21
|
+
load Pathname.new(__FILE__).dirname.join('gherkin/keywords.rb')
|
22
|
+
keywords
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.step_regex
|
26
|
+
# in Gherkin's config, keywords that end in < don't
|
27
|
+
# need word boundaries at the ends - all others do.
|
28
|
+
@step_regex ||= Regexp.new(
|
29
|
+
keywords[:step].map do |w|
|
30
|
+
if w.end_with? '<'
|
31
|
+
Regexp.escape(w.chop)
|
32
|
+
else
|
33
|
+
"#{Regexp.escape(w)}\\b"
|
34
|
+
end
|
35
|
+
end.join('|')
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
rest_of_line = /.*?(?=[#\n])/
|
40
|
+
|
41
|
+
state :basic do
|
42
|
+
rule %r(#.*$), Comment
|
43
|
+
rule /[ \r\t]+/, Text
|
44
|
+
end
|
45
|
+
|
46
|
+
state :root do
|
47
|
+
mixin :basic
|
48
|
+
rule %r(\n), Text
|
49
|
+
rule %r(""".*?""")m, Str
|
50
|
+
rule %r(@[^\s@]+), Name::Tag
|
51
|
+
mixin :has_table
|
52
|
+
mixin :has_examples
|
53
|
+
end
|
54
|
+
|
55
|
+
state :has_scenarios do
|
56
|
+
rule %r((.*?)(:)) do |m|
|
57
|
+
reset_stack
|
58
|
+
|
59
|
+
keyword = m[1]
|
60
|
+
keyword_tok = if self.class.keywords[:element].include? keyword
|
61
|
+
push :description; Keyword::Namespace
|
62
|
+
elsif self.class.keywords[:feature].include? keyword
|
63
|
+
push :feature_description; Keyword::Declaration
|
64
|
+
elsif self.class.keywords[:examples].include? keyword
|
65
|
+
push :example_description; Name::Namespace
|
66
|
+
else
|
67
|
+
Error
|
68
|
+
end
|
69
|
+
|
70
|
+
groups keyword_tok, Punctuation
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
state :has_examples do
|
75
|
+
mixin :has_scenarios
|
76
|
+
rule Gherkin.step_regex, Name::Function do
|
77
|
+
token Name::Function
|
78
|
+
reset_stack; push :step
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
state :has_table do
|
83
|
+
rule(/(?=[|])/) { push :table_header }
|
84
|
+
end
|
85
|
+
|
86
|
+
state :table_header do
|
87
|
+
rule /[^|\s]+/, Name::Variable
|
88
|
+
rule /\n/ do
|
89
|
+
token Text
|
90
|
+
goto :table
|
91
|
+
end
|
92
|
+
mixin :table
|
93
|
+
end
|
94
|
+
|
95
|
+
state :table do
|
96
|
+
mixin :basic
|
97
|
+
rule /\n/, Text, :table_bol
|
98
|
+
rule /[|]/, Punctuation
|
99
|
+
rule /[^|\s]+/, Name
|
100
|
+
end
|
101
|
+
|
102
|
+
state :table_bol do
|
103
|
+
rule(/(?=\s*[^\s|])/) { reset_stack }
|
104
|
+
rule(//) { pop! }
|
105
|
+
end
|
106
|
+
|
107
|
+
state :description do
|
108
|
+
mixin :basic
|
109
|
+
mixin :has_examples
|
110
|
+
rule /\n/, Text
|
111
|
+
rule rest_of_line, Text
|
112
|
+
end
|
113
|
+
|
114
|
+
state :feature_description do
|
115
|
+
mixin :basic
|
116
|
+
mixin :has_scenarios
|
117
|
+
rule /\n/, Text
|
118
|
+
rule rest_of_line, Text
|
119
|
+
end
|
120
|
+
|
121
|
+
state :example_description do
|
122
|
+
mixin :basic
|
123
|
+
mixin :has_table
|
124
|
+
rule /\n/, Text
|
125
|
+
rule rest_of_line, Text
|
126
|
+
end
|
127
|
+
|
128
|
+
state :step do
|
129
|
+
mixin :basic
|
130
|
+
rule /<.*?>/, Name::Variable
|
131
|
+
rule /".*?"/, Str
|
132
|
+
rule /\S+/, Text
|
133
|
+
rule rest_of_line, Text, :pop!
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# automatically generated by `rake builtins:gherkin`
|
3
|
+
module Rouge
|
4
|
+
module Lexers
|
5
|
+
def Gherkin.keywords
|
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", "Όταν", "Αλλά", "Δεδομένου", "Και", "Τότε", "І", "А", "А також", "Агар", "Але", "Али", "Аммо", "Бирок", "Ва", "Вә", "Дадено", "Дано", "Допустим", "Если", "Задате", "Задати", "Задато", "И", "К тому же", "Кад", "Када", "Когато", "Когда", "Коли", "Лекин", "Ләкин", "Нехай", "Но", "Нәтиҗәдә", "Онда", "Припустимо", "Припустимо, що", "Пусть", "Та", "Также", "То", "Тогда", "Тоді", "Унда", "Якщо", "Һәм", "Әгәр", "Әйтик", "Әмма", "אבל", "אז", "אזי", "בהינתן", "וגם", "כאשר", "آنگاه", "اذاً", "اما", "اور", "اگر", "با فرض", "بالفرض", "بفرض", "تب", "ثم", "جب", "عندما", "فرض کیا", "لكن", "لیکن", "متى", "هنگامی", "و", "پھر", "अगर", "और", "कदा", "किन्तु", "चूंकि", "जब", "तथा", "तदा", "तब", "पर", "परन्तु", "यदि", "ਅਤੇ", "ਜਦੋਂ", "ਜਿਵੇਂ ਕਿ", "ਜੇਕਰ", "ਤਦ", "ਪਰ", "అప్పుడు", "ఈ పరిస్థితిలో", "కాని", "చెప్పబడినది", "మరియు", "ಆದರೆ", "ನಂತರ", "ನೀಡಿದ", "ಮತ್ತು", "ಸ್ಥಿತಿಯನ್ನು", "กำหนดให้", "ดังนั้น", "เมื่อ", "แต่", "และ", "かつ<", "しかし<", "ただし<", "ならば<", "もし<", "並且<", "但し<", "但是<", "假如<", "假定<", "假設<", "假设<", "前提<", "同时<", "同時<", "并且<", "当<", "當<", "而且<", "那么<", "那麼<", "그러면<", "그리고<", "단<", "만약<", "만일<", "먼저<", "조건<", "하지만<"]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
module Rouge
|
4
|
+
module Lexers
|
5
|
+
load_const :C, 'c.rb'
|
6
|
+
|
7
|
+
# This file defines the GLSL language lexer to the Rouge
|
8
|
+
# syntax highlighter.
|
9
|
+
#
|
10
|
+
# Author: Sri Harsha Chilakapati
|
11
|
+
class Glsl < C
|
12
|
+
tag 'glsl'
|
13
|
+
filenames '*.glsl', '*.frag', '*.vert', '*.geom', '*.fs', '*.vs', '*.gs', '*.shader'
|
14
|
+
mimetypes 'x-shader/x-vertex', 'x-shader/x-fragment', 'x-shader/x-geometry'
|
15
|
+
|
16
|
+
title "GLSL"
|
17
|
+
desc "The GLSL shader language"
|
18
|
+
|
19
|
+
# optional comment or whitespace
|
20
|
+
ws = %r((?:\s|//.*?\n|/[*].*?[*]/)+)
|
21
|
+
id = /[a-zA-Z_][a-zA-Z0-9_]*/
|
22
|
+
|
23
|
+
def self.keywords
|
24
|
+
@keywords ||= Set.new %w(
|
25
|
+
attribute const uniform varying
|
26
|
+
layout
|
27
|
+
centroid flat smooth noperspective
|
28
|
+
patch sample
|
29
|
+
break continue do for while switch case default
|
30
|
+
if else
|
31
|
+
subroutine
|
32
|
+
in out inout
|
33
|
+
invariant
|
34
|
+
discard return struct precision
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.keywords_type
|
39
|
+
@keywords_type ||= Set.new %w(
|
40
|
+
float double int void bool true false
|
41
|
+
lowp mediump highp
|
42
|
+
mat2 mat3 mat4 dmat2 dmat3 dmat4
|
43
|
+
mat2x2 mat2x3 mat2x4 dmat2x2 dmat2x3 dmat2x4
|
44
|
+
mat3x2 mat3x3 mat3x4 dmat3x2 dmat3x3 dmat3x4
|
45
|
+
mat4x2 mat4x3 mat4x4 dmat4x2 dmat4x3 dmat4x4
|
46
|
+
vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 dvec2 dvec3 dvec4
|
47
|
+
uint uvec2 uvec3 uvec4
|
48
|
+
sampler1D sampler2D sampler3D samplerCube
|
49
|
+
sampler1DShadow sampler2DShadow samplerCubeShadow
|
50
|
+
sampler1DArray sampler2DArray
|
51
|
+
sampler1DArrayShadow sampler2DArrayShadow
|
52
|
+
isampler1D isampler2D isampler3D isamplerCube
|
53
|
+
isampler1DArray isampler2DArray
|
54
|
+
usampler1D usampler2D usampler3D usamplerCube
|
55
|
+
usampler1DArray usampler2DArray
|
56
|
+
sampler2DRect sampler2DRectShadow isampler2DRect usampler2DRect
|
57
|
+
samplerBuffer isamplerBuffer usamplerBuffer
|
58
|
+
sampler2DMS isampler2DMS usampler2DMS
|
59
|
+
sampler2DMSArray isampler2DMSArray usampler2DMSArray
|
60
|
+
samplerCubeArray samplerCubeArrayShadow isamplerCubeArray usamplerCubeArray
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.reserved
|
65
|
+
@reserved ||= Set.new %w(
|
66
|
+
common partition active
|
67
|
+
asm
|
68
|
+
class union enum typedef template this packed
|
69
|
+
goto
|
70
|
+
inline noinline volatile public static extern external interface
|
71
|
+
long short half fixed unsigned superp
|
72
|
+
input output
|
73
|
+
hvec2 hvec3 hvec4 fvec2 fvec3 fvec4
|
74
|
+
sampler3DRect
|
75
|
+
filter
|
76
|
+
image1D image2D image3D imageCube
|
77
|
+
iimage1D iimage2D iimage3D iimageCube
|
78
|
+
uimage1D uimage2D uimage3D uimageCube
|
79
|
+
image1DArray image2DArray
|
80
|
+
iimage1DArray iimage2DArray uimage1DArray uimage2DArray
|
81
|
+
image1DShadow image2DShadow
|
82
|
+
image1DArrayShadow image2DArrayShadow
|
83
|
+
imageBuffer iimageBuffer uimageBuffer
|
84
|
+
sizeof cast
|
85
|
+
namespace using
|
86
|
+
row_major
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.builtins
|
91
|
+
@builtins ||= Set.new %w(
|
92
|
+
gl_VertexID gl_InstanceID gl_PerVertex gl_Position gl_PointSize gl_ClipDistance
|
93
|
+
gl_PrimitiveIDIn gl_InvocationID gl_PrimitiveID gl_Layer gl_ViewportIndex
|
94
|
+
gl_MaxPatchVertices gl_PatchVerticesIn gl_TessLevelOuter gl_TessLevelInner
|
95
|
+
gl_TessCoord gl_FragCoord gl_FrontFacing gl_PointCoord gl_SampleID gl_SamplePosition
|
96
|
+
gl_FragColor gl_FragData gl_MaxDrawBuffers gl_FragDepth gl_SampleMask
|
97
|
+
gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor
|
98
|
+
gl_TexCoord gl_FogFragCoord gl_Color gl_SecondaryColor gl_Normal gl_VertexID
|
99
|
+
gl_MultiTexCord0 gl_MultiTexCord1 gl_MultiTexCord2 gl_MultiTexCord3
|
100
|
+
gl_MultiTexCord4 gl_MultiTexCord5 gl_MultiTexCord6 gl_MultiTexCord7
|
101
|
+
gl_FogCoord gl_MaxVertexAttribs gl_MaxVertexUniformComponents
|
102
|
+
gl_MaxVaryingFloats gl_MaxVaryingComponents gl_MaxVertexOutputComponents
|
103
|
+
gl_MaxGeometryInputComponents gl_MaxGeometryOutputComponents
|
104
|
+
gl_MaxFragmentInputComponents gl_MaxVertexTextureImageUnits
|
105
|
+
gl_MaxCombinedTextureImageUnits gl_MaxTextureImageUnits
|
106
|
+
gl_MaxFragmentUniformComponents gl_MaxClipDistances
|
107
|
+
gl_MaxGeometryTextureImageUnits gl_MaxGeometryUniformComponents
|
108
|
+
gl_MaxGeometryVaryingComponents gl_MaxTessControlInputComponents
|
109
|
+
gl_MaxTessControlOutputComponents gl_MaxTessControlTextureImageUnits
|
110
|
+
gl_MaxTessControlUniformComponents gl_MaxTessControlTotalOutputComponents
|
111
|
+
gl_MaxTessEvaluationInputComponents gl_MaxTessEvaluationOutputComponents
|
112
|
+
gl_MaxTessEvaluationTextureImageUnits gl_MaxTessEvaluationUniformComponents
|
113
|
+
gl_MaxTessPatchComponents gl_MaxTessGenLevel gl_MaxViewports
|
114
|
+
gl_MaxVertexUniformVectors gl_MaxFragmentUniformVectors gl_MaxVaryingVectors
|
115
|
+
gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxClipPlanes gl_DepthRange
|
116
|
+
gl_DepthRangeParameters gl_ModelViewMatrix gl_ProjectionMatrix
|
117
|
+
gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix
|
118
|
+
gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse
|
119
|
+
gl_TextureMatrixInverse gl_ModelViewMatrixTranspose
|
120
|
+
gl_ModelViewProjectionMatrixTranspose gl_TextureMatrixTranspose
|
121
|
+
gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose
|
122
|
+
gl_ModelViewProjectionMatrixInverseTranspose
|
123
|
+
gl_TextureMatrixInverseTranspose gl_NormalScale gl_ClipPlane gl_PointParameters
|
124
|
+
gl_Point gl_MaterialParameters gl_FrontMaterial gl_BackMaterial
|
125
|
+
gl_LightSourceParameters gl_LightSource gl_MaxLights gl_LightModelParameters
|
126
|
+
gl_LightModel gl_LightModelProducts gl_FrontLightModelProduct
|
127
|
+
gl_BackLightModelProduct gl_LightProducts gl_FrontLightProduct
|
128
|
+
gl_BackLightProduct gl_TextureEnvColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR
|
129
|
+
gl_EyePlaneQ gl_ObjectPlaneS gl_ObjectPlaneT gl_ObjectPlaneR gl_ObjectPlaneQ
|
130
|
+
gl_FogParameters gl_Fog
|
131
|
+
)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,178 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
|
3
|
+
module Rouge
|
4
|
+
module Lexers
|
5
|
+
class Go < RegexLexer
|
6
|
+
title "Go"
|
7
|
+
desc 'The Go programming language (http://golang.org)'
|
8
|
+
tag 'go'
|
9
|
+
aliases 'go', 'golang'
|
10
|
+
filenames '*.go'
|
11
|
+
|
12
|
+
mimetypes 'text/x-go', 'application/x-go'
|
13
|
+
|
14
|
+
def self.analyze_text(text)
|
15
|
+
return 0
|
16
|
+
end
|
17
|
+
|
18
|
+
# Characters
|
19
|
+
|
20
|
+
WHITE_SPACE = /[\s\t\r\n]+/
|
21
|
+
|
22
|
+
NEWLINE = /\n/
|
23
|
+
UNICODE_CHAR = /[^\n]/
|
24
|
+
UNICODE_LETTER = /[[:alpha:]]/
|
25
|
+
UNICODE_DIGIT = /[[:digit:]]/
|
26
|
+
|
27
|
+
# Letters and digits
|
28
|
+
|
29
|
+
LETTER = /#{UNICODE_LETTER}|_/
|
30
|
+
DECIMAL_DIGIT = /[0-9]/
|
31
|
+
OCTAL_DIGIT = /[0-7]/
|
32
|
+
HEX_DIGIT = /[0-9A-Fa-f]/
|
33
|
+
|
34
|
+
# Comments
|
35
|
+
|
36
|
+
LINE_COMMENT = /\/\/(?:(?!#{NEWLINE}).)*/
|
37
|
+
GENERAL_COMMENT = /\/\*(?:(?!\*\/).)*\*\//m
|
38
|
+
COMMENT = /#{LINE_COMMENT}|#{GENERAL_COMMENT}/
|
39
|
+
|
40
|
+
# Keywords
|
41
|
+
|
42
|
+
KEYWORD = /\b(?:
|
43
|
+
break | default | func
|
44
|
+
| interface | select | case
|
45
|
+
| defer | go | map
|
46
|
+
| struct | chan | else
|
47
|
+
| goto | package | switch
|
48
|
+
| const | fallthrough | if
|
49
|
+
| range | type | continue
|
50
|
+
| for | import | return
|
51
|
+
| var
|
52
|
+
)\b/x
|
53
|
+
|
54
|
+
# Identifiers
|
55
|
+
|
56
|
+
IDENTIFIER = / (?!#{KEYWORD})
|
57
|
+
#{LETTER}(?:#{LETTER}|#{UNICODE_DIGIT})* /x
|
58
|
+
|
59
|
+
# Operators and delimiters
|
60
|
+
|
61
|
+
OPERATOR = / \+= | \+\+ | \+ | &\^= | &\^
|
62
|
+
| &= | && | & | == | =
|
63
|
+
| \!= | \! | -= | -- | -
|
64
|
+
| \|= | \|\| | \| | <= | <-
|
65
|
+
| <<= | << | < | \*= | \*
|
66
|
+
| \^= | \^ | >>= | >> | >=
|
67
|
+
| > | \/ | \/= | := | %
|
68
|
+
| %= | \.\.\. | \. | :
|
69
|
+
/x
|
70
|
+
|
71
|
+
SEPARATOR = / \( | \) | \[ | \] | \{
|
72
|
+
| \} | , | ;
|
73
|
+
/x
|
74
|
+
|
75
|
+
# Integer literals
|
76
|
+
|
77
|
+
DECIMAL_LIT = /[0-9]#{DECIMAL_DIGIT}*/
|
78
|
+
OCTAL_LIT = /0#{OCTAL_DIGIT}*/
|
79
|
+
HEX_LIT = /0[xX]#{HEX_DIGIT}+/
|
80
|
+
INT_LIT = /#{HEX_LIT}|#{DECIMAL_LIT}|#{OCTAL_LIT}/
|
81
|
+
|
82
|
+
# Floating-point literals
|
83
|
+
|
84
|
+
DECIMALS = /#{DECIMAL_DIGIT}+/
|
85
|
+
EXPONENT = /[eE][+\-]?#{DECIMALS}/
|
86
|
+
FLOAT_LIT = / #{DECIMALS} \. #{DECIMALS}? #{EXPONENT}?
|
87
|
+
| #{DECIMALS} #{EXPONENT}
|
88
|
+
| \. #{DECIMALS} #{EXPONENT}?
|
89
|
+
/x
|
90
|
+
|
91
|
+
# Imaginary literals
|
92
|
+
|
93
|
+
IMAGINARY_LIT = /(?:#{DECIMALS}|#{FLOAT_LIT})i/
|
94
|
+
|
95
|
+
# Rune literals
|
96
|
+
|
97
|
+
ESCAPED_CHAR = /\\[abfnrtv\\'"]/
|
98
|
+
LITTLE_U_VALUE = /\\u#{HEX_DIGIT}{4}/
|
99
|
+
BIG_U_VALUE = /\\U#{HEX_DIGIT}{8}/
|
100
|
+
UNICODE_VALUE = / #{UNICODE_CHAR} | #{LITTLE_U_VALUE}
|
101
|
+
| #{BIG_U_VALUE} | #{ESCAPED_CHAR}
|
102
|
+
/x
|
103
|
+
OCTAL_BYTE_VALUE = /\\#{OCTAL_DIGIT}{3}/
|
104
|
+
HEX_BYTE_VALUE = /\\x#{HEX_DIGIT}{2}/
|
105
|
+
BYTE_VALUE = /#{OCTAL_BYTE_VALUE}|#{HEX_BYTE_VALUE}/
|
106
|
+
CHAR_LIT = /'(?:#{UNICODE_VALUE}|#{BYTE_VALUE})'/
|
107
|
+
ESCAPE_SEQUENCE = / #{ESCAPED_CHAR}
|
108
|
+
| #{LITTLE_U_VALUE}
|
109
|
+
| #{BIG_U_VALUE}
|
110
|
+
| #{HEX_BYTE_VALUE}
|
111
|
+
/x
|
112
|
+
|
113
|
+
# String literals
|
114
|
+
|
115
|
+
RAW_STRING_LIT = /`(?:#{UNICODE_CHAR}|#{NEWLINE})*`/
|
116
|
+
INTERPRETED_STRING_LIT = / "(?: (?!")
|
117
|
+
(?: #{UNICODE_VALUE} | #{BYTE_VALUE} )
|
118
|
+
)*" /x
|
119
|
+
STRING_LIT = /#{RAW_STRING_LIT}|#{INTERPRETED_STRING_LIT}/
|
120
|
+
|
121
|
+
# Predeclared identifiers
|
122
|
+
|
123
|
+
PREDECLARED_TYPES = /\b(?:
|
124
|
+
bool | byte | complex64
|
125
|
+
| complex128 | error | float32
|
126
|
+
| float64 | int8 | int16
|
127
|
+
| int32 | int64 | int
|
128
|
+
| rune | string | uint8
|
129
|
+
| uint16 | uint32 | uint64
|
130
|
+
| uintptr | uint
|
131
|
+
)\b/x
|
132
|
+
|
133
|
+
PREDECLARED_CONSTANTS = /\b(?:true|false|iota|nil)\b/
|
134
|
+
|
135
|
+
PREDECLARED_FUNCTIONS = /\b(?:
|
136
|
+
append | cap | close | complex
|
137
|
+
| copy | delete | imag | len
|
138
|
+
| make | new | panic | print
|
139
|
+
| println | real | recover
|
140
|
+
)\b/x
|
141
|
+
|
142
|
+
state :simple_tokens do
|
143
|
+
rule(COMMENT, Comment)
|
144
|
+
rule(KEYWORD, Keyword)
|
145
|
+
rule(PREDECLARED_TYPES, Keyword::Type)
|
146
|
+
rule(PREDECLARED_FUNCTIONS, Name::Builtin)
|
147
|
+
rule(PREDECLARED_CONSTANTS, Name::Constant)
|
148
|
+
rule(IMAGINARY_LIT, Num)
|
149
|
+
rule(FLOAT_LIT, Num)
|
150
|
+
rule(INT_LIT, Num)
|
151
|
+
rule(CHAR_LIT, Str::Char)
|
152
|
+
rule(OPERATOR, Operator)
|
153
|
+
rule(SEPARATOR, Punctuation)
|
154
|
+
rule(IDENTIFIER, Name)
|
155
|
+
rule(WHITE_SPACE, Other)
|
156
|
+
end
|
157
|
+
|
158
|
+
state :root do
|
159
|
+
mixin :simple_tokens
|
160
|
+
|
161
|
+
rule(/`/, Str, :raw_string)
|
162
|
+
rule(/"/, Str, :interpreted_string)
|
163
|
+
end
|
164
|
+
|
165
|
+
state :interpreted_string do
|
166
|
+
rule(ESCAPE_SEQUENCE, Str::Escape)
|
167
|
+
rule(/\\./, Error)
|
168
|
+
rule(/"/, Str, :pop!)
|
169
|
+
rule(/[^"\\]+/, Str)
|
170
|
+
end
|
171
|
+
|
172
|
+
state :raw_string do
|
173
|
+
rule(/`/, Str, :pop!)
|
174
|
+
rule(/[^`]+/m, Str)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|