rouge-lexers-whatlang 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 320b89c2c408dc94ebccee33b7796145d4071c272958cbef60d22ce23dd60446
4
+ data.tar.gz: 16adab25ba3896fa91d60f80b1e9d40aea68939ef011676f54d659f8e0987fc3
5
+ SHA512:
6
+ metadata.gz: e571dd2ae48d940051c91563a83068d46584221885d246e357038d006d844983965975f9b6fb455e65ecfd61a71ec5707b02daa114fb57b59ced6451838d3802
7
+ data.tar.gz: 2b9244145992f6953067fa6fdd13199ef5d4876e3d9347c357efab36529c157d83e31dd5296bfbddc34c758008fef4f58a7fa3cb239917f339aa8460d7696e9e
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 DGCK81LNN
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,7 @@
1
+ time@ 60000/ 480+: 60/:
2
+ 24/ flr@ 4+ 7%
3
+ "日一二三四五六"\,\_
4
+ "现在是星期"\+"的"+\
5
+ flr@ 24% ':++\
6
+ flr@ 60% :9?1?{ '0\+ !} +
7
+ .
@@ -0,0 +1,103 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class WhatLang < RegexLexer
6
+ title 'WhatLang'
7
+ desc 'a stack-based esoteric programming language'
8
+ tag 'whatlang'
9
+ aliases 'what', 'wl'
10
+ filenames '*.what'
11
+
12
+ state :root do
13
+ rule %r/¿/, Comment::Preproc
14
+ mixin :basic
15
+ rule %r/'./, Str::Char
16
+ rule %r/"/, Str::Double, :double_quote
17
+ rule %r/`/, Str::Backtick, :backtick
18
+ rule %r/\(/, Str, :paren
19
+ rule %r/./, Text
20
+ end
21
+
22
+ state :basic do
23
+ rule %r/\s+/, Text::Whitespace
24
+ rule %r/0/, Keyword::Constant
25
+ rule %r/[1-9]\d*/, Num::Integer
26
+ rule %r/([a-zA-Z][a-zA-Z0-9_]*)(@)/ do
27
+ groups Name::Function, Punctuation
28
+ end
29
+ rule %r/[a-zA-Z][a-zA-Z0-9_]*/, Name
30
+ rule %r/[.\\:&_=^@><#]/, Keyword
31
+ rule %r/[-+*\/%?~.,;$]/, Operator
32
+ rule %r/[\[|\]{}!]/, Punctuation
33
+ end
34
+
35
+ state :double_quote do
36
+ rule %r/[^"\\]+/, Str::Double
37
+ rule %r/\\./, Str::Escape
38
+ rule %r/"/, Str::Double, :pop!
39
+ end
40
+
41
+ state :backtick do
42
+ rule %r/[^`\\]+/, Str::Backtick
43
+ rule %r/\\./, Str::Escape
44
+ rule %r/`/, Str::Backtick, :pop!
45
+ end
46
+
47
+ state :paren do
48
+ rule %r/'\)/, Str, :pop!
49
+ rule %r/\)/, Str, :pop!
50
+ mixin :basic
51
+ rule %r/'./, Str::Char
52
+ rule %r/"/, Str::Double, :paren_double_quote
53
+ rule %r/`/, Str::Backtick, :paren_backtick
54
+ rule %r/\(/, Str, :paren
55
+ rule %r/./, Str
56
+ end
57
+
58
+ state :paren_double_quote do
59
+ rule %r/\(/ do
60
+ token Str::Double
61
+ pop!
62
+ push :paren
63
+ push :paren_double_quote
64
+ end
65
+ rule %r/\)/ do
66
+ pop!
67
+ pop!
68
+ if in_state?(:paren)
69
+ push :paren_double_quote
70
+ token Str::Double
71
+ else
72
+ token Str
73
+ end
74
+ end
75
+ rule %r/[^()"\\]+/, Str::Double
76
+ rule %r/\\./, Str::Escape
77
+ rule %r/"/, Str::Double, :pop!
78
+ end
79
+
80
+ state :paren_backtick do
81
+ rule %r/\(/ do
82
+ token Str::Backtick
83
+ pop!
84
+ push :paren
85
+ push :paren_backtick
86
+ end
87
+ rule %r/\)/ do
88
+ pop!
89
+ pop!
90
+ if in_state?(:paren)
91
+ token Str::Backtick
92
+ push :paren_backtick
93
+ else
94
+ token Str
95
+ end
96
+ end
97
+ rule %r/[^()`\\]+/, Str::Backtick
98
+ rule %r/\\./, Str::Escape
99
+ rule %r/`/, Str::Backtick, :pop!
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1 @@
1
+ require_relative "rouge/lexers/whatlang"
@@ -0,0 +1,28 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "rouge-lexers-whatlang"
3
+ s.version = "1.0.0"
4
+ s.summary =
5
+ "Rouge lexer for WhatLang, a stack-based esolang"
6
+ s.description = <<~END
7
+ == Rouge::Lexers::WhatLang
8
+ {Rouge}[https://github.com/rouge-ruby/rouge] lexer for
9
+ {WhatLang}[https://esolangs.org/wiki/WhatLang], a stack-based esoteric programming language
10
+ END
11
+ s.authors = ["DGCK81LNN"]
12
+ s.email = "triluolnn@163.com"
13
+ s.files = Dir[
14
+ "Gemfile",
15
+ "LICENSE",
16
+ "rouge-lexers-whatlang.gemspec",
17
+ "lib/**/*",
18
+ ]
19
+ s.homepage = "https://github.com/DGCK81LNN/rouge-lexers-whatlang"
20
+ s.license = "MIT"
21
+ s.metadata = {
22
+ "bug_tracker_uri" => "https://github.com/DGCK81LNN/rouge-lexers-whatlang/issues",
23
+ "source_code_uri" => "https://github.com/DGCK81LNN/rouge-lexers-whatlang",
24
+ }
25
+
26
+ s.required_ruby_version = ">= 3.0"
27
+ s.add_runtime_dependency "rouge", ">=3.0", "<5.0"
28
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rouge-lexers-whatlang
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - DGCK81LNN
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rouge
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '3.0'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '5.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '3.0'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '5.0'
32
+ description: |
33
+ == Rouge::Lexers::WhatLang
34
+ {Rouge}[https://github.com/rouge-ruby/rouge] lexer for
35
+ {WhatLang}[https://esolangs.org/wiki/WhatLang], a stack-based esoteric programming language
36
+ email: triluolnn@163.com
37
+ executables: []
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - Gemfile
42
+ - LICENSE
43
+ - lib/rouge-lexers-whatlang.rb
44
+ - lib/rouge/demos/whatlang
45
+ - lib/rouge/lexers/whatlang.rb
46
+ - rouge-lexers-whatlang.gemspec
47
+ homepage: https://github.com/DGCK81LNN/rouge-lexers-whatlang
48
+ licenses:
49
+ - MIT
50
+ metadata:
51
+ bug_tracker_uri: https://github.com/DGCK81LNN/rouge-lexers-whatlang/issues
52
+ source_code_uri: https://github.com/DGCK81LNN/rouge-lexers-whatlang
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.6.7
68
+ specification_version: 4
69
+ summary: Rouge lexer for WhatLang, a stack-based esolang
70
+ test_files: []