parser.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package muesli
  2. import (
  3. _ "bytes"
  4. _ "errors"
  5. _ "fmt"
  6. _ "io"
  7. _ "reflect"
  8. _ "runtime"
  9. _ "strings"
  10. _ "unicode"
  11. _ "io"
  12. _ "os"
  13. _ "bufio"
  14. _ "unicode"
  15. // "gitlab.com/beoran/woe/graphviz"
  16. // _ "gitlab.com/beoran/woe/monolog"
  17. "gitlab.com/beoran/gdast/tree"
  18. )
  19. type AstKind int
  20. const (
  21. AstKindProgram = AstKind(iota)
  22. AstKindStatements
  23. AstKindStatement
  24. AstKindCommand
  25. AstKindArguments
  26. AstKindBlock
  27. AstKindList
  28. AstKindCapture
  29. AstKindWordValue
  30. AstKindWord
  31. AstKindType
  32. AstKindValue
  33. AstKindEox
  34. AstKindError
  35. )
  36. /* AST node kind */
  37. type Ast struct {
  38. tree.Node
  39. AstKind
  40. * Token
  41. }
  42. type Parser struct {
  43. Lexer
  44. Ast
  45. }
  46. func (parser * Parser) ParseProgram() error {
  47. /*
  48. for parser.Position < len(Input) {
  49. }
  50. */
  51. return nil
  52. }
  53. func (parser * Parser) Parse() (Ast, error) {
  54. parser.Index = 0
  55. err := parser.ParseProgram()
  56. return parser.Ast, err
  57. }