mirror of
https://github.com/samsonjs/csc360-a1-shell.git
synced 2026-04-27 14:57:43 +00:00
Use Data.define
This commit is contained in:
parent
beee5deca5
commit
9630125a95
3 changed files with 3 additions and 3 deletions
|
|
@ -21,7 +21,7 @@ GEM
|
||||||
guard
|
guard
|
||||||
rake
|
rake
|
||||||
io-console (0.8.2)
|
io-console (0.8.2)
|
||||||
json (2.18.0)
|
json (2.18.1)
|
||||||
language_server-protocol (3.17.0.5)
|
language_server-protocol (3.17.0.5)
|
||||||
lint_roller (1.1.0)
|
lint_roller (1.1.0)
|
||||||
listen (3.10.0)
|
listen (3.10.0)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
module Shell
|
module Shell
|
||||||
class StringParser
|
class StringParser
|
||||||
Token = Struct.new(:type, :value, keyword_init: true)
|
Token = Data.define(:type, :value)
|
||||||
|
|
||||||
class Scanner
|
class Scanner
|
||||||
def initialize(line, index: 0)
|
def initialize(line, index: 0)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ module Shell
|
||||||
ARITHMETIC_IDENTIFIER_PATTERN = /[A-Za-z0-9_]/
|
ARITHMETIC_IDENTIFIER_PATTERN = /[A-Za-z0-9_]/
|
||||||
ARITHMETIC_OPERATOR_PATTERN = %r{[+\-*/()%]}
|
ARITHMETIC_OPERATOR_PATTERN = %r{[+\-*/()%]}
|
||||||
BRACE_EXPANSION_PATTERN = /(.*?)\{([^{}]*)\}(.*)/
|
BRACE_EXPANSION_PATTERN = /(.*?)\{([^{}]*)\}(.*)/
|
||||||
SplitWord = Struct.new(:text, :globbed, keyword_init: true)
|
SplitWord = Data.define(:text, :globbed)
|
||||||
CommandSubstitutionError = Class.new(StandardError)
|
CommandSubstitutionError = Class.new(StandardError)
|
||||||
|
|
||||||
# Splits the given line into multiple words, performing the following transformations:
|
# Splits the given line into multiple words, performing the following transformations:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue