aboutsummaryrefslogtreecommitdiff
path: root/grammar/semantic_error.go
diff options
context:
space:
mode:
Diffstat (limited to 'grammar/semantic_error.go')
-rw-r--r--grammar/semantic_error.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/grammar/semantic_error.go b/grammar/semantic_error.go
new file mode 100644
index 0000000..01446ed
--- /dev/null
+++ b/grammar/semantic_error.go
@@ -0,0 +1,22 @@
+package grammar
+
+type SemanticError struct {
+ message string
+}
+
+func newSemanticError(message string) *SemanticError {
+ return &SemanticError{
+ message: message,
+ }
+}
+
+func (e *SemanticError) Error() string {
+ return e.message
+}
+
+var (
+ semErrNoProduction = newSemanticError("a grammar needs at least one production")
+ semErrUndefinedSym = newSemanticError("undefined symbol")
+ semErrDirInvalidName = newSemanticError("invalid directive name")
+ semErrDirInvalidParam = newSemanticError("invalid parameter")
+)