Sha256: 2412fa827d14758c5dbf8629586f40821afccab9dadae8f1411164251a5ed00e

Contents?: true

Size: 1002 Bytes

Versions: 2

Compression:

Stored size: 1002 Bytes

Contents

module Qlang
  module Lexer
    module Tokens
      # FIRST TOKEN
      NUM = '[0-9]+'
      VAR = '[a-z]'
      FUNCV = '[a-zA-Z]'
      VARNUM = '[0-9a-z]'
      ANYSP = ' *'
      ANYSTR = '.+'
      NONL = '[^\r\n]'
      LPRN = '\('
      RPRN = '\)'
      LBRC = '\{'
      RBRC = '\}'
      CLN = '\:'
      SCLN = ';'
      CMA = '\,'
      SP = ' '

      # SECOND TOKEN
      class ::String
        def line_by(char)
          "#{ANYSP}#{self}(#{ANYSP}#{char}#{ANYSP}#{self})*#{ANYSP}"
        end
      end
      NUMS_BY_CMA = NUM.line_by(CMA)
      VARS_BY_CMA = VAR.line_by(CMA)
      VARNUMS_BY_CMA = VARNUM.line_by(CMA)
      NUMS_BY_SP = NUM.line_by(SP)

      # THIRD TOKEN
      class ::String
        def func_call
          "#{FUNCV}#{LPRN}#{ANYSP}#{self}#{ANYSP}#{RPRN}"
        end
      end
      FUNCCN =  NUMS_BY_CMA.func_call
      FUNCCV = VARS_BY_CMA.func_call
      FUNCCVN =  VARNUMS_BY_CMA.func_call

      NUMS_BY_SP_BY_SCLN = NUMS_BY_SP.line_by(SCLN)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qlang-0.0.27180000 lib/qlang/lexer/tokens.rb
qlang-0.0.27100000 lib/qlang/lexer/tokens.rb