Skip to content

Commit

Permalink
Merge pull request #722 from viperproject/parser-warnings
Browse files Browse the repository at this point in the history
Parser Warnings
  • Loading branch information
marcoeilers authored Jul 17, 2023
2 parents a28b06f + 94ad1be commit c2c1b11
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/scala/viper/silver/parser/FastParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class FastParser {
var _line_offset: Array[Int] = null
/** The file we are currently parsing (for creating positions later). */
var _file: Path = null
var _warnings: Seq[ParseWarning] = Seq()
private var _warnings: Seq[ParseWarning] = Seq()

def parse(s: String, f: Path, plugins: Option[SilverPluginManager] = None) = {
// Strategy to handle imports
Expand Down Expand Up @@ -830,6 +830,8 @@ class FastParser {
def programDecl(implicit ctx : P[_]) : P[PProgram] =
P(FP((ParserExtension.newDeclAtStart(ctx) | preambleImport | defineDecl | fieldDecl | methodDecl | domainDecl | functionDecl | predicateDecl | ParserExtension.newDeclAtEnd(ctx)).rep).map {
case (pos, decls) => {
val warnings = _warnings
_warnings = Seq()
PProgram(
decls.collect { case i: PImport => i }, // Imports
decls.collect { case d: PDefine => d }, // Macros
Expand All @@ -839,7 +841,7 @@ class FastParser {
decls.collect { case p: PPredicate => p }, // Predicates
decls.collect { case m: PMethod => m }, // Methods
decls.collect { case e: PExtender => e }, // Extensions
Seq() // Parse Errors
warnings // Parse Warnings
)(pos)
}
})
Expand Down

0 comments on commit c2c1b11

Please sign in to comment.