We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent faac877 commit 7880294Copy full SHA for 7880294
lib/parser.rb
@@ -1,4 +1,8 @@
1
class Parser
2
+ class A_COMMAND; end
3
+ class C_COMMAND; end
4
+ class L_COMMAND; end
5
+
6
def initialize(input)
7
@lines = split_lines(input)
8
end
@@ -8,12 +12,22 @@ def has_more_commands?
12
9
13
10
14
def advance
11
- lines.shift
15
+ @current = lines.shift
16
+ end
17
18
+ def command_type
19
+ if current.start_with?('@')
20
+ A_COMMAND
21
+ elsif current.start_with?('(')
22
+ L_COMMAND
23
+ else
24
+ C_COMMAND
25
26
27
28
private
29
- attr_reader :lines
30
+ attr_reader :lines, :current
31
32
def split_lines(input)
33
input
0 commit comments