대체 연산자 ('|')가 포함 된 규칙 주위에서 구분을 해제하려고하는데 호환되지 않는 구분 기호에 대한 컴파일 오류가 발생합니다. 예를 들어, 내가 부스트에서 calc2_ast_dump.cpp 예를 갔고, 수 구조체 dump_ast에서 ast_node 규칙을 수정 :boost :: spirit :: karma : 대체와 함께 no_delimit 사용
ast_node %= no_delimit[int_ | binary_node | unary_node];
그러나 이것은 컴파일 오류 제공 :
/usr/include/boost/function/function_template.hpp:754:17: note: candidate function not viable: no known conversion
from 'const
boost::spirit::karma::detail::unused_delimiter<boost::spirit::karma::any_space<boost::spirit::char_encoding::ascii>
>' to 'const boost::spirit::karma::any_space<boost::spirit::char_encoding::ascii>' for 3rd argument
result_type operator()(BOOST_FUNCTION_PARMS) const
와 관련 의견을 부스트에서/정신/홈/업/비단/rule.hpp : (사용하여 내 자신의 프로젝트에
// If you are seeing a compilation error here stating that the
// third parameter can't be converted to a karma::reference
// then you are probably trying to use a rule or a grammar with
// an incompatible delimiter type.
, 나는 문제없이 "no_delimit [A < < B]를"할 수 있어요 karma :: space delimiter).
대체 방법에 대해 누락 된 것이 있습니까? no_delimit은 '< <'과 함께 작동하지만 '|'가 아닌 이유는 무엇입니까?
부스트 1.48을 사용하고 있으므로 픽업해야하는 버그 픽스가 있습니까?
아에서 라이브를 참조하십시오. 하지만 내 프로젝트가 아닌 내 프로젝트를 명확히하기 위해 no_delimit에 사용 된 모든 하위 규칙 만 구분 기호를 사용하지 않도록 작성해야합니다. 이 이해가 맞습니까? – EHuhtala
네, 기본적으로 맞습니다. skipper 유형을 템플릿 인수로'dump_ast' 생성기에 추가 할 수 있으며, 기본값을'spirit :: unused_type'으로 지정하면 규칙 정의를 변경하지 않고도 변경할 수 있습니다. – sehe