Updated more referencs to constants

master
Aadhavan Srinivasan 3 days ago
parent a63426d965
commit cbd679949f

@ -768,7 +768,7 @@ func shuntingYard(re string, flags ...ReFlag) ([]postfixNode, error) {
// Keep popping from opStack until we encounter an opening parantheses or a NONCAPLPAREN_CHAR. Throw error if we reach the end of the stack. // Keep popping from opStack until we encounter an opening parantheses or a NONCAPLPAREN_CHAR. Throw error if we reach the end of the stack.
var val rune var val rune
var err error var err error
for val, err = peek(opStack); val != '(' && val != NONCAPLPAREN_CHAR; val, err = peek(opStack) { for val, err = peek(opStack); val != '(' && val != nonCapLparenRune; val, err = peek(opStack) {
if err != nil { if err != nil {
return nil, fmt.Errorf("imbalanced parantheses") return nil, fmt.Errorf("imbalanced parantheses")
} }

@ -115,7 +115,7 @@ func range2regex(start int, end int) (string, error) {
if startSlc[i] == endSlc[i] { if startSlc[i] == endSlc[i] {
regex += string(rune(startSlc[i] + 48)) // '0' is ascii value 48, 1 is 49 etc. To convert the digit to its character form, we can just add 48. regex += string(rune(startSlc[i] + 48)) // '0' is ascii value 48, 1 is 49 etc. To convert the digit to its character form, we can just add 48.
} else { } else {
regex += fmt.Sprintf("%c%c-%c%c", lbracketRune, rune(startSlc[i]+48), rune(endSlc[i]+48), RBRACKET) regex += fmt.Sprintf("%c%c-%c%c", lbracketRune, rune(startSlc[i]+48), rune(endSlc[i]+48), rbracketRune)
} }
} }
regex += ")" regex += ")"

Loading…
Cancel
Save