Sha256: 603ed33a157ac611a1742ff1d789a95a726fb1f7899a2789350385daffa081ef

Contents?: true

Size: 629 Bytes

Versions: 5

Compression:

Stored size: 629 Bytes

Contents

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

class TwitterCldr.Parser

  constructor : (@tokens) ->
    @token_index = 0

  parse : (tokens, options = {}) ->
    @tokens = tokens
    @reset()
    @do_parse(options)

  reset : ->
    @token_index = 0

  next_token : (type) ->
    throw "Unexpected token" unless @current_token().type == type

    @token_index += 1

    while @current_token()? and @is_empty(@current_token())
      @token_index += 1

    @current_token()

  is_empty : (token) ->
    token.type == "plaintext" and token.value == ""

  current_token : ->
    @tokens[@token_index]

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter_cldr_js-3.3.0 lib/twitter_cldr/js/mustache/implementation/parsers/parser.coffee
twitter_cldr_js-3.2.0 lib/twitter_cldr/js/mustache/implementation/parsers/parser.coffee
twitter_cldr_js-3.1.1 lib/twitter_cldr/js/mustache/implementation/parsers/parser.coffee
twitter_cldr_js-3.1.0 lib/twitter_cldr/js/mustache/implementation/parsers/parser.coffee
twitter_cldr_js-2.4.0 lib/twitter_cldr/js/mustache/parsers/parser.coffee