Skip to content

Commit

Permalink
Support raw string in the new parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
akshanshbhatt committed Jul 4, 2022
1 parent 65f729b commit 7288add
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lpython/parser/semantics.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ static inline ast_t *PREFIX_STRING(Allocator &al, Location &l, char *prefix, cha
}
str = "b'" + str + "'";
tmp = make_ConstantBytes_t(al, l, LFortran::s2c(al, str), nullptr);
} else if (strcmp(prefix, "r") == 0 ) {
tmp = make_ConstantStr_t(al, l, s, nullptr);
} else {
throw LFortran::LFortranException("The string is not recognized by the parser.");
}
return tmp;
}
Expand Down

0 comments on commit 7288add

Please sign in to comment.