Sha256: 295ca26a8b1c008e771665d5b5d9e357c384bfdbe9b2b9b6938c82db2706cfa2

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 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 >> (match('[A-Za-z]') >> match['[A-Za-z0-9_]'].repeat(0)).as(:url_variable) }

		rule(:url_token) { (url_variable | (match('[A-Za-z]') >> match['[A-Za-z0-9_]'].repeat(0)).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.4 lib/shift-lang/parser/routing_expression_parser.rb