fasta

package
v0.0.0-...-4c43aeb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Example
package main

import (
	"bramp.net/antlr4/fasta"

	"fmt"
	"github.com/antlr/antlr4/runtime/Go/antlr"
)

type exampleListener struct {
	*fasta.BasefastaListener
}

func (l *exampleListener) EnterEveryRule(ctx antlr.ParserRuleContext) {
	fmt.Println(ctx.GetText())
}
func main() {
	// Setup the input
	is := antlr.NewInputStream("...some text to parse...")

	// Create the Lexer
	lexer := fasta.NewfastaLexer(is)
	stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)

	// Create the Parser
	p := fasta.NewfastaParser(stream)
	p.BuildParseTrees = true
	p.AddErrorListener(antlr.NewDiagnosticErrorListener(true))

	// Finally walk the tree
	tree := p.Sequence()
	antlr.ParseTreeWalkerDefault.Walk(&exampleListener{}, tree)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewfastaLexer

func NewfastaLexer(input antlr.CharStream) *fastaLexer

func NewfastaParser

func NewfastaParser(input antlr.TokenStream) *fastaParser

Types

type BasefastaListener

type BasefastaListener struct{}

BasefastaListener is a complete listener for a parse tree produced by fastaParser.

func (*BasefastaListener) EnterCommentline

func (s *BasefastaListener) EnterCommentline(ctx *CommentlineContext)

EnterCommentline is called when production commentline is entered.

func (*BasefastaListener) EnterDescriptionline

func (s *BasefastaListener) EnterDescriptionline(ctx *DescriptionlineContext)

EnterDescriptionline is called when production descriptionline is entered.

func (*BasefastaListener) EnterEveryRule

func (s *BasefastaListener) EnterEveryRule(ctx antlr.ParserRuleContext)

EnterEveryRule is called when any rule is entered.

func (*BasefastaListener) EnterSection

func (s *BasefastaListener) EnterSection(ctx *SectionContext)

EnterSection is called when production section is entered.

func (*BasefastaListener) EnterSequence

func (s *BasefastaListener) EnterSequence(ctx *SequenceContext)

EnterSequence is called when production sequence is entered.

func (*BasefastaListener) EnterSequencelines

func (s *BasefastaListener) EnterSequencelines(ctx *SequencelinesContext)

EnterSequencelines is called when production sequencelines is entered.

func (*BasefastaListener) ExitCommentline

func (s *BasefastaListener) ExitCommentline(ctx *CommentlineContext)

ExitCommentline is called when production commentline is exited.

func (*BasefastaListener) ExitDescriptionline

func (s *BasefastaListener) ExitDescriptionline(ctx *DescriptionlineContext)

ExitDescriptionline is called when production descriptionline is exited.

func (*BasefastaListener) ExitEveryRule

func (s *BasefastaListener) ExitEveryRule(ctx antlr.ParserRuleContext)

ExitEveryRule is called when any rule is exited.

func (*BasefastaListener) ExitSection

func (s *BasefastaListener) ExitSection(ctx *SectionContext)

ExitSection is called when production section is exited.

func (*BasefastaListener) ExitSequence

func (s *BasefastaListener) ExitSequence(ctx *SequenceContext)

ExitSequence is called when production sequence is exited.

func (*BasefastaListener) ExitSequencelines

func (s *BasefastaListener) ExitSequencelines(ctx *SequencelinesContext)

ExitSequencelines is called when production sequencelines is exited.

func (*BasefastaListener) VisitErrorNode

func (s *BasefastaListener) VisitErrorNode(node antlr.ErrorNode)

VisitErrorNode is called when an error node is visited.

func (*BasefastaListener) VisitTerminal

func (s *BasefastaListener) VisitTerminal(node antlr.TerminalNode)

VisitTerminal is called when a terminal node is visited.

type CommentlineContext

type CommentlineContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewCommentlineContext

func NewCommentlineContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CommentlineContext

func NewEmptyCommentlineContext

func NewEmptyCommentlineContext() *CommentlineContext

func (*CommentlineContext) COMMENTLINE

func (s *CommentlineContext) COMMENTLINE() antlr.TerminalNode

func (*CommentlineContext) EnterRule

func (s *CommentlineContext) EnterRule(listener antlr.ParseTreeListener)

func (*CommentlineContext) ExitRule

func (s *CommentlineContext) ExitRule(listener antlr.ParseTreeListener)

func (*CommentlineContext) GetParser

func (s *CommentlineContext) GetParser() antlr.Parser

func (*CommentlineContext) GetRuleContext

func (s *CommentlineContext) GetRuleContext() antlr.RuleContext

func (*CommentlineContext) IsCommentlineContext

func (*CommentlineContext) IsCommentlineContext()

func (*CommentlineContext) ToStringTree

func (s *CommentlineContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type DescriptionlineContext

type DescriptionlineContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewDescriptionlineContext

func NewDescriptionlineContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DescriptionlineContext

func NewEmptyDescriptionlineContext

func NewEmptyDescriptionlineContext() *DescriptionlineContext

func (*DescriptionlineContext) DESCRIPTIONLINE

func (s *DescriptionlineContext) DESCRIPTIONLINE() antlr.TerminalNode

func (*DescriptionlineContext) EnterRule

func (s *DescriptionlineContext) EnterRule(listener antlr.ParseTreeListener)

func (*DescriptionlineContext) ExitRule

func (s *DescriptionlineContext) ExitRule(listener antlr.ParseTreeListener)

func (*DescriptionlineContext) GetParser

func (s *DescriptionlineContext) GetParser() antlr.Parser

func (*DescriptionlineContext) GetRuleContext

func (s *DescriptionlineContext) GetRuleContext() antlr.RuleContext

func (*DescriptionlineContext) IsDescriptionlineContext

func (*DescriptionlineContext) IsDescriptionlineContext()

func (*DescriptionlineContext) ToStringTree

func (s *DescriptionlineContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type ICommentlineContext

type ICommentlineContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsCommentlineContext differentiates from other interfaces.
	IsCommentlineContext()
}

ICommentlineContext is an interface to support dynamic dispatch.

type IDescriptionlineContext

type IDescriptionlineContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsDescriptionlineContext differentiates from other interfaces.
	IsDescriptionlineContext()
}

IDescriptionlineContext is an interface to support dynamic dispatch.

type ISectionContext

type ISectionContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsSectionContext differentiates from other interfaces.
	IsSectionContext()
}

ISectionContext is an interface to support dynamic dispatch.

type ISequenceContext

type ISequenceContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsSequenceContext differentiates from other interfaces.
	IsSequenceContext()
}

ISequenceContext is an interface to support dynamic dispatch.

type ISequencelinesContext

type ISequencelinesContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsSequencelinesContext differentiates from other interfaces.
	IsSequencelinesContext()
}

ISequencelinesContext is an interface to support dynamic dispatch.

type SectionContext

type SectionContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptySectionContext

func NewEmptySectionContext() *SectionContext

func NewSectionContext

func NewSectionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SectionContext

func (*SectionContext) Commentline

func (s *SectionContext) Commentline() ICommentlineContext

func (*SectionContext) Descriptionline

func (s *SectionContext) Descriptionline() IDescriptionlineContext

func (*SectionContext) EnterRule

func (s *SectionContext) EnterRule(listener antlr.ParseTreeListener)

func (*SectionContext) ExitRule

func (s *SectionContext) ExitRule(listener antlr.ParseTreeListener)

func (*SectionContext) GetParser

func (s *SectionContext) GetParser() antlr.Parser

func (*SectionContext) GetRuleContext

func (s *SectionContext) GetRuleContext() antlr.RuleContext

func (*SectionContext) IsSectionContext

func (*SectionContext) IsSectionContext()

func (*SectionContext) Sequencelines

func (s *SectionContext) Sequencelines() ISequencelinesContext

func (*SectionContext) ToStringTree

func (s *SectionContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type SequenceContext

type SequenceContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptySequenceContext

func NewEmptySequenceContext() *SequenceContext

func NewSequenceContext

func NewSequenceContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SequenceContext

func (*SequenceContext) AllSection

func (s *SequenceContext) AllSection() []ISectionContext

func (*SequenceContext) EnterRule

func (s *SequenceContext) EnterRule(listener antlr.ParseTreeListener)

func (*SequenceContext) ExitRule

func (s *SequenceContext) ExitRule(listener antlr.ParseTreeListener)

func (*SequenceContext) GetParser

func (s *SequenceContext) GetParser() antlr.Parser

func (*SequenceContext) GetRuleContext

func (s *SequenceContext) GetRuleContext() antlr.RuleContext

func (*SequenceContext) IsSequenceContext

func (*SequenceContext) IsSequenceContext()

func (*SequenceContext) Section

func (s *SequenceContext) Section(i int) ISectionContext

func (*SequenceContext) ToStringTree

func (s *SequenceContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type SequencelinesContext

type SequencelinesContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptySequencelinesContext

func NewEmptySequencelinesContext() *SequencelinesContext

func NewSequencelinesContext

func NewSequencelinesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SequencelinesContext

func (*SequencelinesContext) AllSEQUENCELINE

func (s *SequencelinesContext) AllSEQUENCELINE() []antlr.TerminalNode

func (*SequencelinesContext) EnterRule

func (s *SequencelinesContext) EnterRule(listener antlr.ParseTreeListener)

func (*SequencelinesContext) ExitRule

func (s *SequencelinesContext) ExitRule(listener antlr.ParseTreeListener)

func (*SequencelinesContext) GetParser

func (s *SequencelinesContext) GetParser() antlr.Parser

func (*SequencelinesContext) GetRuleContext

func (s *SequencelinesContext) GetRuleContext() antlr.RuleContext

func (*SequencelinesContext) IsSequencelinesContext

func (*SequencelinesContext) IsSequencelinesContext()

func (*SequencelinesContext) SEQUENCELINE

func (s *SequencelinesContext) SEQUENCELINE(i int) antlr.TerminalNode

func (*SequencelinesContext) ToStringTree

func (s *SequencelinesContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL