다음과 같은 구문 분석 문제가 있습니다. 아래의 첫 번째 샘플 텍스트에서 구문 분석은 두 개의 명령 블록이 텍스트의 일부를 찾으면 충돌합니다.변경 명령 (Rebol2)을 사용할 때 구문 분석 문제
다음을 시도해보십시오 (Rebol 2).
sample-text: {<a href="javascript:gotoURL('displayContent.aspx?contentID=9&language=english#Deferred-member');">deferred member</a>}
remove-anchors: func [sample-text][
parse sample-text[
some [
to {<a href="javascript:gotoURL('displayContent.aspx?contentID=9}
begin:
thru {);">}
ending:
(print "Command 1 executed")
to "<"
begin:
thru ">"
ending:
(print "Command 2 executed")
]
]
return sample-text
]
결과 :
remove-anchors sample-text
Command 1 executed
Command 2 executed
그러나, 내가 발견 한 텍스트를 제거 할 것으로 예상되는 명령의 변경/부분 부분을 삽입 할 경우 첫 번째 변경/부분이 실행되지만 두 번째 실행 블록이 트리거되지 않아 parse 명령의 두 번째 부분이 중지됩니다.
sample-text: {<a href="javascript:gotoURL('displayContent.aspx?contentID=9&language=english#Deferred-member');">deferred member</a>}
remove-anchors: func [sample-text][
parse sample-text[
some [
to {<a href="javascript:gotoURL('displayContent.aspx?contentID=9}
begin:
thru {);">}
ending:
(print "Command 1 executed" change/part begin "" ending) ;<<----- change
to "<"
begin:
thru ">"
ending:
(print "Command 2 executed" change/part begin "" ending) ;<<----- change
]
]
return sample-text
]
결과 : 두 번째 명령은 인쇄가 실행되지 않고 구문 분석이 완료되지 모두에 의해 실행하는 것 같지 않았어요
remove-anchors sample-text
Command 1 executed
== "deferred member</a>"
참고.
텍스트에서 여러 가지 유형의 링크가 있기 때문에 동일한 HTML에서 이러한 부분을 제거하려고하고 있으며 PARSE가 올바른 해결책이라고 생각했습니다.
내가 뭘 잘못하고 있는지 알 수 있습니까? 이
remove-anchors: func [sample-text][
parse sample-text[
some [
to {<a href="javascript:gotoURL('displayContent.aspx?contentID=9}
begin:
thru {);">}
ending:
(print "Command 1 executed" change/part begin "" ending)
:begin ; note this
to "<"
begin:
thru ">"
ending:
(print "Command 2 executed" change/part begin "" ending)
]
]
return sample-text
]
설명을 사용하는 경우
감사합니다. sqlab. 이 문제가 해결되었습니다. – Brock