Class: Esoteric::Compiler::Whitespace

Inherits:
Base
  • Object
show all
Defined in:
lib/esoteric/compiler/whitespace.rb

Constant Summary collapse

VERSION =
"#{Esoteric::VERSION::SUMMARY}, whitespace 0.0.1"
NVAL =
/([ \t]+)\n/
LVAL =
NVAL
PUSH =
/  #{NVAL}/
DUP =
/ \n /
COPY =
/ \t #{NVAL}/
SWAP =
/ \n\t/
DISCARD =
/ \n\n/
SLIDE =
/ \t\n#{NVAL}/
ADD =
/\t   /
SUB =
/\t  \t/
MUL =
/\t  \n/
DIV =
/\t \t /
MOD =
/\t \t\t/
HWRITE =
/\t\t /
HREAD =
/\t\t\t/
LABEL =
/\n  #{LVAL}/
CALL =
/\n \t#{LVAL}/
JUMP =
/\n \n#{LVAL}/
JUMPZ =
/\n\t #{LVAL}/
JUMPN =
/\n\t\t#{LVAL}/
RETURN =
/\n\t\n/
EXIT =
/\n\n\n/
COUT =
/\t\n  /
NOUT =
/\t\n \t/
CIN =
/\t\n\t /
NIN =
/\t\n\t\t/

Instance Method Summary collapse

Methods inherited from Base

compile, #compile

Constructor Details

#initialize(src, logger = nil) ⇒ Whitespace

Returns a new instance of Whitespace.



37
38
39
40
# File 'lib/esoteric/compiler/whitespace.rb', line 37

def initialize(src,logger=nil)
  super
  @s = StringScanner.new(@src)
end