이러한 오류 :문제 호출 표준 : 최대
... \ position.hh (83) : 오류 C2589 : '('불법 토큰 '::'
... \ position.hh (83) : 오류 C2059 : 구문 오류 : '::'
... \ position.hh (83) : 오류 C2589 : '(' : 우측 불법 토큰 ':'
... \ position.hh (83) : 오류 C2059 : 구문 오류 ':'
공동 대응 코드 :
inline void columns (int count = 1)
{
column = std::max (1u, column + count);
}
나는이 문제가 std :: max와 같다고 생각한다. 만약 std :: max를 동급 코드로 바꾸면 더 이상 문제는 없지만 생성 된 코드를 변경하는 대신 더 나은 해결책이 있습니까?
//
// bison.yy
//
%skeleton "lalr1.cc"
%require "2.4.2"
%defines
%define parser_class_name "cmd_parser"
%locations
%debug
%error-verbose
%code requires {
class ParserDriver;
}
%parse-param { ParserDriver& driver }
%lex-param { ParserDriver& driver }
%union {
struct ast *a;
double d;
struct symbol *s;
struct symlist *sl;
int fn;
}
%code {
#include "helper_func.h"
#include "ParserDriver.h"
std::string error_msg = "";
}
%token <d> NUMBER
%token <s> NAME
%token <fn> FUNC
%token EOL
%token IF THEN ELSE WHILE DO LET
%token SYM_TABLE_OVERFLOW
%token UNKNOWN_CHARACTER
%nonassoc <fn> CMP
%right '='
%left '+' '-'
%left '*' '/'
%nonassoc '|' UMINUS
%type <a> exp stmt list explist
%type <sl> symlist
%{
extern int yylex(yy::cmd_parser::semantic_type *yylval,
yy::cmd_parser::location_type* yylloc);
%}
%start calclist
%%
... grammar rules ...