VisitPackageDecl visits a parse tree produced by MangleParser#packageDecl.
(ctx *gen.PackageDeclContext)
| 247 | |
| 248 | // VisitPackageDecl visits a parse tree produced by MangleParser#packageDecl. |
| 249 | func (p Parser) VisitPackageDecl(ctx *gen.PackageDeclContext) any { |
| 250 | text := ctx.NAME().GetText() |
| 251 | if text != strings.ToLower(text) { |
| 252 | p.errors.Add(fmt.Sprintf("package names have to be lower-case: %s", text), ctx.GetStart().GetLine(), ctx.GetStart().GetColumn()) |
| 253 | } |
| 254 | name := ast.NewAtom("name", ast.String(text)) |
| 255 | atoms := []ast.Atom{name} |
| 256 | if atomsCtx := ctx.Atoms(); atomsCtx != nil { |
| 257 | atoms = append(atoms, p.Visit(atomsCtx).([]ast.Atom)...) |
| 258 | } |
| 259 | return ast.Decl{DeclaredAtom: ast.Atom{Predicate: symbols.Package}, Descr: atoms} |
| 260 | } |
| 261 | |
| 262 | // VisitUseDecl visits a parse tree produced by MangleParser#useDecl. |
| 263 | func (p Parser) VisitUseDecl(ctx *gen.UseDeclContext) any { |