Skip to content

Commit

Permalink
Restore comment spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Richtermeister committed Nov 16, 2023
1 parent dc3892d commit ff1719c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion parsing.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ loop:
}

/*
Checks the balance of tokens which have multiple parts, such as parenthesis.
Checks the balance of tokens which have multiple parts, such as parenthesis.
*/
func checkBalance(tokens []ExpressionToken) error {

Expand Down
56 changes: 28 additions & 28 deletions stagePlanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ var stageSymbolMap = map[OperatorSymbol]evaluationOperator{
}

/*
A "precedent" is a function which will recursively parse new evaluateionStages from a given stream of tokens.
It's called a `precedent` because it is expected to handle exactly what precedence of operator,
and defer to other `precedent`s for other operators.
A "precedent" is a function which will recursively parse new evaluateionStages from a given stream of tokens.
It's called a `precedent` because it is expected to handle exactly what precedence of operator,
and defer to other `precedent`s for other operators.
*/
type precedent func(stream *tokenStream) (*evaluationStage, error)

/*
A convenience function for specifying the behavior of a `precedent`.
Most `precedent` functions can be described by the same function, just with different type checks, symbols, and error formats.
This struct is passed to `makePrecedentFromPlanner` to create a `precedent` function.
A convenience function for specifying the behavior of a `precedent`.
Most `precedent` functions can be described by the same function, just with different type checks, symbols, and error formats.
This struct is passed to `makePrecedentFromPlanner` to create a `precedent` function.
*/
type precedencePlanner struct {
validSymbols map[string]OperatorSymbol
Expand Down Expand Up @@ -145,8 +145,8 @@ func init() {
}

/*
Given a planner, creates a function which will evaluate a specific precedence level of operators,
and link it to other `precedent`s which recurse to parse other precedence levels.
Given a planner, creates a function which will evaluate a specific precedence level of operators,
and link it to other `precedent`s which recurse to parse other precedence levels.
*/
func makePrecedentFromPlanner(planner *precedencePlanner) precedent {

Expand Down Expand Up @@ -174,9 +174,9 @@ func makePrecedentFromPlanner(planner *precedencePlanner) precedent {
}

/*
Creates a `evaluationStageList` object which represents an execution plan (or tree)
which is used to completely evaluate a set of tokens at evaluation-time.
The three stages of evaluation can be thought of as parsing strings to tokens, then tokens to a stage list, then evaluation with parameters.
Creates a `evaluationStageList` object which represents an execution plan (or tree)
which is used to completely evaluate a set of tokens at evaluation-time.
The three stages of evaluation can be thought of as parsing strings to tokens, then tokens to a stage list, then evaluation with parameters.
*/
func planStages(tokens []ExpressionToken) (*evaluationStage, error) {

Expand Down Expand Up @@ -205,8 +205,8 @@ func planTokens(stream *tokenStream) (*evaluationStage, error) {
}

/*
The most usual method of parsing an evaluation stage for a given precedence.
Most stages use the same logic
The most usual method of parsing an evaluation stage for a given precedence.
Most stages use the same logic
*/
func planPrecedenceLevel(
stream *tokenStream,
Expand Down Expand Up @@ -290,7 +290,7 @@ func planPrecedenceLevel(
}

/*
A special case where functions need to be of higher precedence than values, and need a special wrapped execution stage operator.
A special case where functions need to be of higher precedence than values, and need a special wrapped execution stage operator.
*/
func planFunction(stream *tokenStream) (*evaluationStage, error) {

Expand Down Expand Up @@ -365,8 +365,8 @@ func planAccessor(stream *tokenStream) (*evaluationStage, error) {
}

/*
A truly special precedence function, this handles all the "lowest-case" errata of the process, including literals, parmeters,
clauses, and prefixes.
A truly special precedence function, this handles all the "lowest-case" errata of the process, including literals, parmeters,
clauses, and prefixes.
*/
func planValue(stream *tokenStream) (*evaluationStage, error) {

Expand Down Expand Up @@ -447,8 +447,8 @@ func planValue(stream *tokenStream) (*evaluationStage, error) {
}

/*
Convenience function to pass a triplet of typechecks between `findTypeChecks` and `planPrecedenceLevel`.
Each of these members may be nil, which indicates that type does not matter for that value.
Convenience function to pass a triplet of typechecks between `findTypeChecks` and `planPrecedenceLevel`.
Each of these members may be nil, which indicates that type does not matter for that value.
*/
type typeChecks struct {
left stageTypeCheck
Expand All @@ -457,7 +457,7 @@ type typeChecks struct {
}

/*
Maps a given [symbol] to a set of typechecks to be used during runtime.
Maps a given [symbol] to a set of typechecks to be used during runtime.
*/
func findTypeChecks(symbol OperatorSymbol) typeChecks {

Expand Down Expand Up @@ -552,8 +552,8 @@ func findTypeChecks(symbol OperatorSymbol) typeChecks {
}

/*
During stage planning, stages of equal precedence are parsed such that they'll be evaluated in reverse order.
For commutative operators like "+" or "-", it's no big deal. But for order-specific operators, it ruins the expected result.
During stage planning, stages of equal precedence are parsed such that they'll be evaluated in reverse order.
For commutative operators like "+" or "-", it's no big deal. But for order-specific operators, it ruins the expected result.
*/
func reorderStages(rootStage *evaluationStage) {

Expand Down Expand Up @@ -598,9 +598,9 @@ func reorderStages(rootStage *evaluationStage) {
}

/*
Performs a "mirror" on a subtree of stages.
This mirror functionally inverts the order of execution for all members of the [stages] list.
That list is assumed to be a root-to-leaf (ordered) list of evaluation stages, where each is a right-hand stage of the last.
Performs a "mirror" on a subtree of stages.
This mirror functionally inverts the order of execution for all members of the [stages] list.
That list is assumed to be a root-to-leaf (ordered) list of evaluation stages, where each is a right-hand stage of the last.
*/
func mirrorStageSubtree(stages []*evaluationStage) {

Expand Down Expand Up @@ -645,7 +645,7 @@ func mirrorStageSubtree(stages []*evaluationStage) {
}

/*
Recurses through all operators in the entire tree, eliding operators where both sides are literals.
Recurses through all operators in the entire tree, eliding operators where both sides are literals.
*/
func elideLiterals(root *evaluationStage) *evaluationStage {

Expand All @@ -661,9 +661,9 @@ func elideLiterals(root *evaluationStage) *evaluationStage {
}

/*
Elides a specific stage, if possible.
Returns the unmodified [root] stage if it cannot or should not be elided.
Otherwise, returns a new stage representing the condensed value from the elided stages.
Elides a specific stage, if possible.
Returns the unmodified [root] stage if it cannot or should not be elided.
Otherwise, returns a new stage representing the condensed value from the elided stages.
*/
func elideStage(root *evaluationStage) *evaluationStage {

Expand Down

0 comments on commit ff1719c

Please sign in to comment.