Sha256: 632a4013e2acc50768e52b15e1bbb2377d0c3183c3f35c1ffd2bcdf8250f141f

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require 'parslet'

module Shift
	module Parser
		include Parslet

		rule(:url_method) { get_keyword.as(:url_method) | post_keyword.as(:url_method) }

		rule(:url_variable) { colon >> identifier.as(:url_variable) }

		rule(:url_token) { (url_variable | identifier.as(:url_token)) >> fwd_slash.maybe }

		rule(:url) { fwd_slash >> url_token.repeat(0) }


		rule(:model_definition_statement) { model_keyword >> space >> identifier.as(:model_name) }

		rule(:model_attribute_type) { string_keyword | integer_keyword }

		rule(:model_attribute_definition_statement) { identifier.as(:attribute_name) >> space >> model_attribute_type.as(:attribute_type) }

		rule(:model_definition) { model_definition_statement.as(:model_definition_statement) | model_attribute_definition_statement.as(:model_attribute_definition_statement) }


		rule(:write_statement) { write_keyword >> space >> string_valued_expression.as(:write_statement_param) }

		rule(:write_file_statement) { write_file_keyword >> space >> string_valued_expression.as(:file_name) >> (space? >> comma >> space? >> variables).as(:template_values).repeat(0) }
	

		rule(:redirect_statement) { redirect_keyword >> space >> string_valued_expression.as(:redirect_statement_param) }

	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shift-lang-0.1.1 lib/shift-lang/parser/routing_expression_parser.rb