Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Invalid rune literal syntax generation for class matcher #147

Open
sno2 opened this issue May 5, 2024 · 3 comments
Open

Invalid rune literal syntax generation for class matcher #147

sno2 opened this issue May 5, 2024 · 3 comments

Comments

@sno2
Copy link

sno2 commented May 5, 2024

Given this grammar:

ox80_oxBF <- [\200-\277]

The generated grammar code has a syntax error saying more than one character in rune literal:

var g = &grammar{
	rules: []*rule{
		{
			name: "ox80_oxBF",
			pos:  position{line: 1, col: 1, offset: 0},
			expr: &charClassMatcher{
				pos:        position{line: 1, col: 14, offset: 13},
				val:        "[\\200-\\277]",
				ranges:     []rune{'\u0080', '┬┐'}, // <- error here
				ignoreCase: false,
				inverted:   false,
			},
		},
	},
}

Thank you for your work.

@fy0
Copy link

fy0 commented May 16, 2024

I got this:

		{
			name: "ox80_oxBF",
			expr: &charClassMatcher{
				val:        "[\\200-\\277]",
				ranges:     []rune{'\u0080', '¿'},
				ignoreCase: false,
				inverted:   false,
			},
		},

It seems ok:

ord('¿')
191

ord('\277')
191

@sno2
Copy link
Author

sno2 commented May 21, 2024

@fy0 Seems like something spooky is going on... I am on Windows using the latest release. What are you on?

@fy0
Copy link

fy0 commented May 30, 2024

@fy0 Seems like something spooky is going on... I am on Windows using the latest release. What are you on?

Same, on windows 11.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants