Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix #77: Fix error and debug line/columns #78

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove compensations for lineIdx incrementing when advancing to new…
…line
  • Loading branch information
NoelTautges committed Jan 28, 2025
commit fbef8c60b5a6997a3f12e19e8b730a1ab181dbf3
4 changes: 2 additions & 2 deletions includes.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ package main

import (
"fmt"
"github.com/electrikmilk/args-parser"
"os"
"slices"
"strings"

"github.com/electrikmilk/args-parser"
)

// include is a data structure to track include statements.
Expand Down Expand Up @@ -78,7 +79,6 @@ func parseInclude() {
advance()

var includePath = collectRawString()
lineIdx--

if slices.Contains(included, includePath) {
parserError(fmt.Sprintf("File '%s' has already been included.", includePath))
Expand Down
7 changes: 3 additions & 4 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ package main
import (
"encoding/json"
"fmt"
"github.com/electrikmilk/args-parser"
"github.com/google/uuid"
"os"
"regexp"
"slices"
"strconv"
"strings"
"unicode"

"github.com/electrikmilk/args-parser"
"github.com/google/uuid"
)

var idx int
Expand Down Expand Up @@ -281,7 +282,6 @@ func collectVariableValue(constant bool, valueType *tokenType, value *any, coerc
collectValue(valueType, value, '\n')

if constant && (*valueType == Arr || *valueType == Variable) {
lineIdx--
parserError(fmt.Sprintf("Type %v values cannot be constants.", *valueType))
}
if *valueType == Question {
Expand Down Expand Up @@ -564,7 +564,6 @@ func collectVariable(constant bool) {
skipWhitespace()
collectType(&valueType, &value)
case constant:
lineIdx--
parserError("Constants must be initialized with a value.")
}

Expand Down