Skip to content

Commit

Permalink
Fix: Fatal error: length > 1 in coercion to logical
Browse files Browse the repository at this point in the history
  • Loading branch information
marekjagielski committed May 7, 2022
1 parent 5db2cf5 commit ab8279e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: rly
Type: Package
Title: Tools to Create Formal Language Parsers
Version: 1.7.0
Date: 2022-04-11
Date: 2022-05-07
Authors@R: c(person("Marek", "Jagielski",
role = c("aut", "cre", "cph"),
email = "marek.jagielski@gmail.com"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
### Changes in [not yet released]

### Changes in v1.7.1

#### BUG FIXES

1. Fix: Fatal error: length > 1 in coercion to logical

### Changes in v1.7.0

#### BUG FIXES
Expand Down
7 changes: 4 additions & 3 deletions R/lex.R
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,10 @@ LexerReflect <- R6::R6Class("LexerReflect",
},
# Validate literals
validate_literals = function() {
for(l in self$literals) {
if(!is.character(l) | nchar(l) > 1) {
self$log$error('Invalid literal. Must be a single character')
for (l in self$literals) {
if (typeof(l) != "character" ||
(length(self$literals) > 1 && nchar(l) > 1)) {
self$log$error("Invalid literal. Must be a single character")
self$error <- TRUE
}
}
Expand Down

0 comments on commit ab8279e

Please sign in to comment.