inspirer / textmapper

Lexer and Parser generator
http://textmapper.org
MIT License
108 stars 25 forks source link

~ character in the package name breaks generated code #47

Open rnestertsov opened 3 years ago

rnestertsov commented 3 years ago

I've noticed strange behavior with the code generator for my grammar.

I have a "~" char in the package name I define inside my "tm" file and as result code produced by textmapper becomes invalid.

Example: Package name inside tm file:

package = "git.sr.ht/~rn/lang"

Generated lexer.go (the problem exist in other files too):

import (
    "git.sr.ht/~rn/lang"
    "strings"
    "unicode/utf8"
)

// generated by Textmapper; DO NOT EDIT

package git.sr.ht/~rn/lang

Textmapper generate valid code once I remove "~" char from package name.