Esempio n. 1
0
	Rule = any_type

	any_type        = sickle.Indirect()
	any_type_actual = sickle.Choice(
		b_dict,
		b_list,
		b_string,
		b_int,
	)

	b_dict   = sickle.Seq(dict_start, dict_elements, end)
	b_list   = sickle.Seq(list_start, list_elements, end)
	b_int    = sickle.Seq(int_start, b_sint, end)
	b_string = sickle.LengthValue(sickle.Left(parseUint(b_uint), colon), sickle.Byte())

	dict_elements = sickle.Many(dict_element)
	list_elements = sickle.Many(list_element)

	dict_element = sickle.Seq(b_string, any_type)
	list_element = any_type

	b_uint = flatten(sickle.Choice(zero, whole_num))
	b_sint = flatten(sickle.Choice(zero, whole_num, neg_num))

	zero      = sickle.Ch('0')
	whole_num = sickle.Seq(pos_digit, sickle.Many(digit))
	neg_num   = sickle.Seq(neg, whole_num)

	neg       = sickle.Ch('-')
	pos_digit = sickle.ChRange('1', '9')
	digit     = sickle.ChRange('0', '9')
Esempio n. 2
0
package xpath

import (
	"sickle"
)

func init() {
	comment.Bind(comment_actual)
}

// lexical fragments: these are not terminals themselves but are used to build
// terminals.
var (
	digits     = sickle.Many1(sickle.ChRange('0', '9'))
	digits_opt = sickle.Many(sickle.ChRange('0', '9'))

	ncname_start_char = sickle.Choice(
		sickle.ChRange('A', 'Z'),
		sickle.Ch('_'),
		sickle.ChRange('a', 'z'),
		sickle.ChRange(0xC0, 0xD6),
		sickle.ChRange(0xD8, 0xF6),
		sickle.ChRange(0xF8, 0x2FF),
		sickle.ChRange(0x370, 0x37D),
		sickle.ChRange(0x27F, 0x1FFF),
		sickle.ChRange(0x200C, 0x200D),
		sickle.ChRange(0x2070, 0x218F),
		sickle.ChRange(0x2C00, 0x2FEF),
		sickle.ChRange(0x3001, 0xD7FF),
		sickle.ChRange(0xF900, 0xFDCF),
		sickle.ChRange(0xFDF0, 0xFFFD),