genmachine 0.1.0 → 0.1.1

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.
data/TODO ADDED
@@ -0,0 +1,6 @@
1
+ - mechanism for simple nondeterminism
2
+ - syn highlight
3
+ - parser generator implementation notes / examples
4
+ - bootstrap a real spec parser with a real intermediate language
5
+ - full test suite that languages can essentially inherit from for testing
6
+ their implementations.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/genmachine.gemspec CHANGED
@@ -5,18 +5,19 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{genmachine}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joseph Wecker"]
12
- s.date = %q{2011-08-11}
12
+ s.date = %q{2011-08-15}
13
13
  s.default_executable = %q{genmachine}
14
14
  s.description = %q{Takes a state table where the following are defined: state, input+conditions, accumulate-action, pre-transition-actions, and transition-to. It takes that state table and generates very fast parsers. Similar to Ragel. Currently only outputs pure Ruby.}
15
15
  s.email = %q{joseph.wecker@gmail.com}
16
16
  s.executables = ["genmachine"]
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE.txt",
19
- "README.rdoc"
19
+ "README.rdoc",
20
+ "TODO"
20
21
  ]
21
22
  s.files = [
22
23
  ".document",
@@ -24,6 +25,7 @@ Gem::Specification.new do |s|
24
25
  "LICENSE.txt",
25
26
  "README.rdoc",
26
27
  "Rakefile",
28
+ "TODO",
27
29
  "VERSION",
28
30
  "bin/genmachine",
29
31
  "genmachine.gemspec",
@@ -36,6 +38,7 @@ Gem::Specification.new do |s|
36
38
  "lib/genmachine/generators/templates/ruby/executable.erb",
37
39
  "lib/genmachine/generators/templates/ruby/lib.erb.rb",
38
40
  "lib/genmachine/spec_parser.rb",
41
+ "misc/genmachine.vim",
39
42
  "test/helper.rb",
40
43
  "test/test_genmachine.rb"
41
44
  ]
@@ -107,7 +107,8 @@ module GenMachine
107
107
  '\r' => "\r", '\f' => "\f",
108
108
  '\b' => "\b", '\a' => "\a",
109
109
  '\e' => "\e", '\s' => " ",
110
- '\[' => '[', '\]' => ']'}
110
+ '\[' => '[', '\]' => ']',
111
+ "\\\\" => '\\'}
111
112
  def parse_combine_ranges(raw, input)
112
113
  raw.gsub!(/\\[tnrfbaes\[\]]/){|m| ESCAPES[m]}
113
114
  if raw =~ /((?:.-.)*)((?:.)*)/um
@@ -0,0 +1,83 @@
1
+ " Vim syntax file
2
+ " Language: genmachine-spec
3
+ " Maintainer: Joseph Wecker
4
+ " Latest Revision: 2011-8-15
5
+ " License: None, Public Domain
6
+ "
7
+ " genmachine mode for (g)vim, more or less from scratch.
8
+ "
9
+ "
10
+ " TODO:
11
+ "
12
+
13
+ if version < 600
14
+ syntax clear
15
+ elseif exists("b:current_syntax")
16
+ finish
17
+ endif
18
+
19
+ syn match gmComment /^\s*[^\|:].*$/
20
+
21
+ syn match gmNormalRow /^\s*| .*$/ contains=gmNStartCond
22
+ syn region gmNStartCond start=/| / end=/|/me=e-1 skip=/|[^ ]/ contained nextgroup=gmNInput contains=gmDelim,gmState,gmSpecState
23
+ syn region gmNInput start=/| / end=/|/me=e-1 skip=/|[^ ]/ contained nextgroup=gmNAcc contains=gmDelim,gmRange,gmCondPhrase
24
+ syn region gmNAcc start=/| / end=/|/me=e-1 skip=/|[^ ]/ contained nextgroup=gmNCode contains=gmDelim,gmAccDiscard,gmAccum
25
+ syn region gmNCode start=/| / end=/|/me=e-1 skip=/|[^ ]/ contained nextgroup=gmNTransition contains=gmDelim,gmGlobals,gmOperators,gmSpecialVars
26
+ syn region gmNTransition start=/| / end=/|/me=e-1 skip=/|[^ ]/ contained nextgroup=gmEndComment contains=gmDelim,gmState,gmReturn,gmCall
27
+
28
+ syn match gmFollowRow /^\s*: .*$/ contains=gmFStartCond
29
+ syn region gmFStartCond start=/: / end=/:/me=e-1 skip=/:[^ ]/ contained nextgroup=gmFInput contains=gmDelim,gmState,gmSpecState
30
+ syn region gmFInput start=/: / end=/:/me=e-1 skip=/:[^ ]/ contained nextgroup=gmFAcc contains=gmDelim,gmRange,gmCondPhrase
31
+ syn region gmFAcc start=/: / end=/:/me=e-1 skip=/:[^ ]/ contained nextgroup=gmFCode contains=gmDelim,gmAccDiscard,gmAccum
32
+ syn region gmFCode start=/: / end=/:/me=e-1 skip=/:[^ ]/ contained nextgroup=gmFTransition contains=gmDelim,gmGlobals,gmOperators,gmSpecialVars
33
+ syn region gmFTransition start=/: / end=/:/me=e-1 skip=/:[^ ]/ contained nextgroup=gmEndComment contains=gmDelim,gmState,gmReturn,gmCall
34
+
35
+ syn match gmDelim /[|:;,\][{}]/ contained
36
+ syn match gmOperators /[=<>+]\+/ contained contains=gmSpecOps
37
+ syn match gmSpecOps /<<</ contained
38
+ syn match gmSpecState /\s*{[^}]\+}\s*/ contained
39
+ syn match gmState /\s*:[^ )({}]\+\s*/ contained
40
+ syn match gmGlobals /\$\w\+/ contained
41
+
42
+ syn region gmRange start=/\[/ end=/\]/ skip=/\\\]/ keepend contained contains=gmSpecMetas,gmMetachars,gmRangeDelims
43
+ syn match gmSpecMetas /\\s\|\\n/ contained
44
+ syn match gmMetachars /\\t\|\\r\|\\f\|\\b\|\\a\|\\e\|\\\[\|\\\]\|\\\\/ contained
45
+ syn match gmRangeDelims /\\\@!\[\|\\\@!]/ contained
46
+ syn match gmRange /\./ contained
47
+ syn match gmCondPhrase /{[^}]\+}/ contained contains=gmCond,gmOperators,gmGlobals "TODO: contains operators, numbers, etc. etc.
48
+ syn match gmCond /[{}]/ contained
49
+
50
+ syn match gmAccDiscard /<</ contained
51
+ syn match gmAccum /[a-zA-Z_][a-zA-Z0-9_]*<</ contained contains=gmOperators
52
+
53
+ syn keyword gmSpecialVars p s contained
54
+
55
+ syn match gmReturn /<[^>]*>/ contained
56
+ syn match gmCall /[a-zA-Z_][a-zA-Z0-9_]*([^)]*)/ contained contains=gmState
57
+
58
+ syn match gmEndComment /.*$/ contained contains=gmDelim
59
+
60
+
61
+ hi def link gmComment Comment
62
+ hi def link gmEndComment Comment
63
+ hi def link gmNStartCond Label
64
+ hi def link gmDelim Delimiter
65
+ hi def link gmState Constant
66
+ hi def link gmRange Character
67
+ hi def link gmSpecMetas SpecialChar
68
+ hi def link gmMetachars String
69
+ hi def link gmCond Conditional
70
+ hi def link gmCondPhrase Identifier
71
+ hi def link gmAccDiscard Repeat
72
+ hi def link gmAccum Identifier
73
+ hi def link gmOperators Operator
74
+ hi def link gmGlobals Typedef
75
+ hi def link gmSpecOps Constant
76
+ hi def link gmSpecialVars Structure
77
+ hi def link gmNCode Identifier
78
+ hi def link gmFCode Identifier
79
+ hi def link gmReturn PreProc
80
+ hi def link gmCall Function
81
+ hi def link gmSpecState Macro
82
+
83
+ let b:current_syntax = "genmachine"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genmachine
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joseph Wecker
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-11 00:00:00 -07:00
18
+ date: 2011-08-15 00:00:00 -07:00
19
19
  default_executable: genmachine
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -87,12 +87,14 @@ extensions: []
87
87
  extra_rdoc_files:
88
88
  - LICENSE.txt
89
89
  - README.rdoc
90
+ - TODO
90
91
  files:
91
92
  - .document
92
93
  - Gemfile
93
94
  - LICENSE.txt
94
95
  - README.rdoc
95
96
  - Rakefile
97
+ - TODO
96
98
  - VERSION
97
99
  - bin/genmachine
98
100
  - genmachine.gemspec
@@ -105,6 +107,7 @@ files:
105
107
  - lib/genmachine/generators/templates/ruby/executable.erb
106
108
  - lib/genmachine/generators/templates/ruby/lib.erb.rb
107
109
  - lib/genmachine/spec_parser.rb
110
+ - misc/genmachine.vim
108
111
  - test/helper.rb
109
112
  - test/test_genmachine.rb
110
113
  has_rdoc: true