Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > 2fee571c8ff7f751b8ffd67176c1660f > files > 116

re2c-2.0.3-1.mga7.armv7hl.rpm

//go:generate re2go -c $INPUT -o $OUTPUT -i
package main

import "testing"
/*!include:re2c "definitions.go" */

func lex(str string) int {
	var cursor int
	/*!re2c
	re2c:yyfill:enable  = 0;
	re2c:define:YYCTYPE = byte;
	re2c:define:YYPEEK  = "str[cursor]";
	re2c:define:YYSKIP  = "cursor += 1";

	number { return ResultOk }
	*      { return ResultFail }
	*/
}

func TestLex(t *testing.T) {
	if lex("123\000") != ResultOk {
		t.Errorf("error")
	}
}