2017-05-29 23:17:07 +00:00
|
|
|
package zclsyntax
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/zclconf/go-zcl/zcl"
|
|
|
|
)
|
|
|
|
|
2017-05-30 00:19:23 +00:00
|
|
|
// ParseConfig parses the given buffer as a whole zcl config file, returning
|
|
|
|
// a Body representing its contents. If HasErrors called on the returned
|
|
|
|
// diagnostics returns true, the returned body is likely to be incomplete
|
|
|
|
// and should therefore be used with care.
|
|
|
|
func ParseConfig(src []byte, filename string, start zcl.Pos) Body {
|
|
|
|
panic("ParseConfig is not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
// ParseExpression parses the given buffer as a standalone zcl expression,
|
|
|
|
// returning it as an instance of Expression.
|
|
|
|
func ParseExpression(src []byte, filename string, start zcl.Pos) Expression {
|
|
|
|
panic("ParseExpression is not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
// ParseTemplate parses the given buffer as a standalone zcl template,
|
|
|
|
// returning it as an instance of Expression.
|
|
|
|
func ParseTemplate(src []byte, filename string, start zcl.Pos) Expression {
|
|
|
|
panic("ParseTemplate is not yet implemented")
|
|
|
|
}
|
|
|
|
|
2017-05-29 23:17:07 +00:00
|
|
|
// LexConfig performs lexical analysis on the given buffer, treating it as a
|
|
|
|
// whole zcl config file, and returns the resulting tokens.
|
|
|
|
func LexConfig(src []byte, filename string, start zcl.Pos) Tokens {
|
|
|
|
return scanTokens(src, filename, start, scanNormal)
|
|
|
|
}
|
|
|
|
|
|
|
|
// LexExpression performs lexical analysis on the given buffer, treating it as
|
|
|
|
// a standalone zcl expression, and returns the resulting tokens.
|
|
|
|
func LexExpression(src []byte, filename string, start zcl.Pos) Tokens {
|
|
|
|
// This is actually just the same thing as LexConfig, since configs
|
|
|
|
// and expressions lex in the same way.
|
|
|
|
return scanTokens(src, filename, start, scanNormal)
|
|
|
|
}
|
|
|
|
|
|
|
|
// LexTemplate performs lexical analysis on the given buffer, treating it as a
|
|
|
|
// standalone zcl template, and returns the resulting tokens.
|
|
|
|
func LexTemplate(src []byte, filename string, start zcl.Pos) Tokens {
|
|
|
|
return scanTokens(src, filename, start, scanTemplate)
|
|
|
|
}
|