|
|
|
@ -38,12 +38,12 @@ const (
|
|
|
|
|
BlockRef = "#^"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Lex(name, input string) *Lexer {
|
|
|
|
|
func Lex(name, input string, level zapcore.Level) *Lexer {
|
|
|
|
|
encoderCfg := zap.NewProductionEncoderConfig()
|
|
|
|
|
encoderCfg.EncodeTime = zapcore.ISO8601TimeEncoder
|
|
|
|
|
|
|
|
|
|
config := zap.Config{
|
|
|
|
|
Level: zap.NewAtomicLevelAt(zap.InfoLevel),
|
|
|
|
|
Level: zap.NewAtomicLevelAt(level),
|
|
|
|
|
EncoderConfig: encoderCfg,
|
|
|
|
|
OutputPaths: []string{
|
|
|
|
|
"./lexer.log",
|
|
|
|
@ -150,7 +150,7 @@ func (l *Lexer) emit(t LexemeType) {
|
|
|
|
|
L := l.L.Named("emit").With(
|
|
|
|
|
zap.String("item", i.String()),
|
|
|
|
|
)
|
|
|
|
|
L.Debug("emitting lexeme")
|
|
|
|
|
L.Info("emitting lexeme")
|
|
|
|
|
l.Items = append(l.Items, i)
|
|
|
|
|
l.SetStart(l.GetPos())
|
|
|
|
|
/* original concurrent implementation
|
|
|
|
|