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