저는 Treetop을 처음 사용하고 문법이 매우 간단하여 작업을 수행 할 수 없습니다. 나는 몇 가지 테스트가 있습니다Treetop 문법이 "/"를 인식하지 못합니다.
it "parses a open tag as some text surrouded by brackets" do
document = "[b]"
Parser.parse(document).should_not be_nil
end
it "parses a close tag as a tag with a/preceeding the tag name" do
document = '[/b]'
Parser.parse(document).should_not be_nil
end
이 내 문법입니다 :
는 첫 번째 테스트를 통과grammar BBCode
rule open_tag
"[" tag_name "]"
end
rule tag_name
[a-zA-Z\*]+
end
rule close_tag
"[/" tag_name "]"
end
end
, 두 번째 테스트가 실패합니다. 또한 다음 대체 규칙을 시도했습니다.
"[" [\/] tag_name "]"
"[" "/" tag_name "]"
"[\/" tag_name "]"
모두 실패했습니다.
제가 시도한 내용에 상관없이 닫는 태그를 인식하지 못하는 것 같습니다.
흠을 [mathematica 문법] (https://github.com/farleyknight/mathematica_parser/blob/master/lib/mathematica.treetop)에는''/ ''이 있으며 제대로 작동하는 것 같습니다. –
많은 예를 보았습니다. 그러므로 내 혼란 :/ – DVG