kubernetes/vendor/github.com/antlr4-go/antlr/v4/tokenstream_rewriter.go

const DefaultProgramName

const ProgramInitSize

const MinTokenIndex

type RewriteOperation

type BaseRewriteOperation

func (op *BaseRewriteOperation) GetInstructionIndex() int {}

func (op *BaseRewriteOperation) GetIndex() int {}

func (op *BaseRewriteOperation) GetText() string {}

func (op *BaseRewriteOperation) GetOpName() string {}

func (op *BaseRewriteOperation) GetTokens() TokenStream {}

func (op *BaseRewriteOperation) SetInstructionIndex(val int) {}

func (op *BaseRewriteOperation) SetIndex(val int) {}

func (op *BaseRewriteOperation) SetText(val string) {}

func (op *BaseRewriteOperation) SetOpName(val string) {}

func (op *BaseRewriteOperation) SetTokens(val TokenStream) {}

func (op *BaseRewriteOperation) Execute(_ *bytes.Buffer) int {}

func (op *BaseRewriteOperation) String() string {}

type InsertBeforeOp

func NewInsertBeforeOp(index int, text string, stream TokenStream) *InsertBeforeOp {}

func (op *InsertBeforeOp) Execute(buffer *bytes.Buffer) int {}

func (op *InsertBeforeOp) String() string {}

type InsertAfterOp

func NewInsertAfterOp(index int, text string, stream TokenStream) *InsertAfterOp {}

func (op *InsertAfterOp) Execute(buffer *bytes.Buffer) int {}

func (op *InsertAfterOp) String() string {}

type ReplaceOp

func NewReplaceOp(from, to int, text string, stream TokenStream) *ReplaceOp {}

func (op *ReplaceOp) Execute(buffer *bytes.Buffer) int {}

func (op *ReplaceOp) String() string {}

type TokenStreamRewriter

func NewTokenStreamRewriter(tokens TokenStream) *TokenStreamRewriter {}

func (tsr *TokenStreamRewriter) GetTokenStream() TokenStream {}

// Rollback the instruction stream for a program so that
// the indicated instruction (via instructionIndex) is no
// longer in the stream. UNTESTED!
func (tsr *TokenStreamRewriter) Rollback(programName string, instructionIndex int) {}

func (tsr *TokenStreamRewriter) RollbackDefault(instructionIndex int) {}

// DeleteProgram Reset the program so that no instructions exist
func (tsr *TokenStreamRewriter) DeleteProgram(programName string) {}

func (tsr *TokenStreamRewriter) DeleteProgramDefault() {}

func (tsr *TokenStreamRewriter) InsertAfter(programName string, index int, text string) {}

func (tsr *TokenStreamRewriter) InsertAfterDefault(index int, text string) {}

func (tsr *TokenStreamRewriter) InsertAfterToken(programName string, token Token, text string) {}

func (tsr *TokenStreamRewriter) InsertBefore(programName string, index int, text string) {}

func (tsr *TokenStreamRewriter) InsertBeforeDefault(index int, text string) {}

func (tsr *TokenStreamRewriter) InsertBeforeToken(programName string, token Token, text string) {}

func (tsr *TokenStreamRewriter) Replace(programName string, from, to int, text string) {}

func (tsr *TokenStreamRewriter) ReplaceDefault(from, to int, text string) {}

func (tsr *TokenStreamRewriter) ReplaceDefaultPos(index int, text string) {}

func (tsr *TokenStreamRewriter) ReplaceToken(programName string, from, to Token, text string) {}

func (tsr *TokenStreamRewriter) ReplaceTokenDefault(from, to Token, text string) {}

func (tsr *TokenStreamRewriter) ReplaceTokenDefaultPos(index Token, text string) {}

func (tsr *TokenStreamRewriter) Delete(programName string, from, to int) {}

func (tsr *TokenStreamRewriter) DeleteDefault(from, to int) {}

func (tsr *TokenStreamRewriter) DeleteDefaultPos(index int) {}

func (tsr *TokenStreamRewriter) DeleteToken(programName string, from, to Token) {}

func (tsr *TokenStreamRewriter) DeleteTokenDefault(from, to Token) {}

func (tsr *TokenStreamRewriter) GetLastRewriteTokenIndex(programName string) int {}

func (tsr *TokenStreamRewriter) GetLastRewriteTokenIndexDefault() int {}

func (tsr *TokenStreamRewriter) SetLastRewriteTokenIndex(programName string, i int) {}

func (tsr *TokenStreamRewriter) InitializeProgram(name string) []RewriteOperation {}

func (tsr *TokenStreamRewriter) AddToProgram(name string, op RewriteOperation) {}

func (tsr *TokenStreamRewriter) GetProgram(name string) []RewriteOperation {}

// GetTextDefault returns the text from the original tokens altered per the
// instructions given to this rewriter.
func (tsr *TokenStreamRewriter) GetTextDefault() string {}

// GetText returns the text from the original tokens altered per the
// instructions given to this rewriter.
func (tsr *TokenStreamRewriter) GetText(programName string, interval Interval) string {}

// reduceToSingleOperationPerIndex combines operations and report invalid operations (like
// overlapping replaces that are not completed nested). Inserts to
// same index need to be combined etc...
//
// Here are the cases:
//
//	 I.i.u I.j.v								leave alone, non-overlapping
//	 I.i.u I.i.v								combine: Iivu
//
//	 R.i-j.u R.x-y.v	| i-j in x-y			delete first R
//	 R.i-j.u R.i-j.v							delete first R
//	 R.i-j.u R.x-y.v	| x-y in i-j			ERROR
//	 R.i-j.u R.x-y.v	| boundaries overlap	ERROR
//
//	 Delete special case of replace (text==null):
//	 D.i-j.u D.x-y.v	| boundaries overlap	combine to max(min)..max(right)
//
//	 I.i.u R.x-y.v | i in (x+1)-y			delete I (since insert before
//													we're not deleting i)
//	 I.i.u R.x-y.v | i not in (x+1)-y		leave alone, non-overlapping
//	 R.x-y.v I.i.u | i in x-y				ERROR
//	 R.x-y.v I.x.u 							R.x-y.uv (combine, delete I)
//	 R.x-y.v I.i.u | i not in x-y			leave alone, non-overlapping
//
//	 I.i.u = insert u before op @ index i
//	 R.x-y.u = replace x-y indexed tokens with u
//
// First we need to examine replaces. For any replace op:
//
//  1. wipe out any insertions before op within that range.
//  2. Drop any replace op before that is contained completely within
//     that range.
//  3. Throw exception upon boundary overlap with any previous replace.
//
// Then we can deal with inserts:
//
//  1. for any inserts to same index, combine even if not adjacent.
//  2. for any prior replace with same left boundary, combine this
//     insert with replace and delete this 'replace'.
//  3. throw exception if index in same range as previous replace
//
// Don't actually delete; make op null in list. Easier to walk list.
// Later we can throw as we add to index → op map.
//
// Note that I.2 R.2-2 will wipe out I.2 even though, technically, the
// inserted stuff would be before the 'replace' range. But, if you
// add tokens in front of a method body '{' and then delete the method
// body, I think the stuff before the '{' you added should disappear too.
//
// The func returns a map from token index to operation.
func reduceToSingleOperationPerIndex(rewrites []RewriteOperation) map[int]RewriteOperation {}

func max(a, b int) int {}

func min(a, b int) int {}