World: r3wp
[Parse] Discussion of PARSE dialect
older newer | first last |
BrianH 24-Dec-2008 [3401x2] | If you weren't careful you could easily overflow system/words :( |
Must go now - it's been fun :) | |
Maxim 24-Dec-2008 [3403] | yes cool. ciao... |
BrianH 29-Dec-2008 [3404] | I finished the Parse Proposals cleanup again. Enjoy! |
GiuseppeC 29-Dec-2008 [3405x2] | I have read the cleanupped version. I like the "To-Thru" proposal to match for multiple ends but I have read that full grammar could not be used for "performance reasons". |
However the proposal is really big and I think that implementing it would not be so easy and fast. Will we see it complete at the end of 2009 ? It is only Carl working on it :-( | |
BrianH 29-Dec-2008 [3407x2] | The real advantage to the TO/THRU enhancement comes when it lets you avoid creating charsets, which are a lot less useful with Unicode. It should be pretty easy to implement. |
I think that the proposals are more than Carl was thinking they would be - apparently he had forgotten the previous proposal lists. I don't think that it will be too much of a problem though, as there are not really that many proposals that are likely to be accepted. Some are competing proposals, of which only one would be chosen. Also, there aren't that many proposals overall - they are just thoroughly specified. | |
GiuseppeC 29-Dec-2008 [3409x3] | Lets see how things evolves. Proposal are very interesting as they would easy a lot of work on building parse rules. Everything is silent apart some blog messages where I have read for the first time the word "Beta" connected with REBOL3. |
(*ease) | |
Good night. Here in Italy is 20 past 1AM. | |
BrianH 29-Dec-2008 [3412x4] | My main concern is that Carl's main requirements of the proposal process have been ignored in some cases: - That the proposals be concisely specified. The Purpose and Importance statements should be one sentence each. - That there be no discussion of theory. - That there be no specification of equivalent rules. - That all discussions happen outside of the wiki. - That this is a proposals page, not documentation. |
While I appreciate the speculative documentation, it will need to be moved to another page once the proposals process is done. | |
As it is, I hope Carl will read a paper that long when he gets to the point of taking on PARSE. | |
The whole point of the proposals process was to prevent exactly what happened, so in that respect I failed. | |
PeterWood 29-Dec-2008 [3416] | If Carl sticks to his word in his intial request all the proposals will be rejected: Each improvement will require test code be provided that would certify its correctness. No test code, no improvement. (Sorry... you often ask me what you can do to help. Please don't put the burden of testing such changes on me.) |
BrianH 29-Dec-2008 [3417x3] | The test code hasn't been written yet. |
The initial request was not the blog post - that came later. | |
The test code won't be in the wiki. | |
PeterWood 29-Dec-2008 [3420] | That doesn't appear logical to me. In his blog Carl specifically stated that proposals without test ocde would not be considered. You are saying the opposite. |
BrianH 29-Dec-2008 [3421x3] | He didn't say that to me, nor did he specify any format for the test cases in his initial version of the proposals wiki. |
We will have test cases once the test case syntax is specified. | |
They won't go in the wiki though, at least not the main page. The page is too big already. | |
Janko 31-Jan-2009 [3424] | Hi, I need am asking for some help with parse again... are there any detailed docs with examples about parse? |
Josh 31-Jan-2009 [3425] | One that I used when I was learning was Brett's http://www.codeconscious.com/rebol/parse-tutorial.html |
Graham 31-Jan-2009 [3426x2] | Brett has lots of examples on parse |
oops ... snap! | |
[unknown: 5] 31-Jan-2009 [3428] | http://www.rebol.com/docs/core23/rebolcore-15.html |
Janko 31-Jan-2009 [3429x6] | aha, I remeber I learned a lot from that green page too.. thanks for links so far , I will read the pages and hopefully I will find something related to the problems I have |
thanks paul for your link too, I couldn't find that page on google ( I did the bret's one) | |
the last problem I had and steeve and oldes propsoed solutions... I got steeve's one but I don't get what "complement charset" in olde's does.. >>str: "a.b.c.d!e?f. " chars: complement charset ".!?" >> parse str [any chars tmp: to end (uppercase tmp)] str == "a.B.C.D!E?F. "<< | |
I think my problem is of this kind: http://www.mail-archive.com/[rebol-list-:-rebol-:-com]/msg16347.html | |
or in terms of Brett's examples: == true >> a: copy "dog cat" parse a [ ANY [ thru "dog" (print 1) | thru "cat" (print 2) ] ] 1 2 == true >> a: copy "cat dog" parse a [ ANY [ thru "dog" (print 1) | thru "cat" (print 2) ] ] 1 == true | |
basically similar problem that last time as I see now.. so by looking at that mailing list answers I have 2 solutions ... I use parse 3 times on a string.. or maybe I use Ladislav's parseen which he said solves this.. but I don't yet know how :) | |
[unknown: 5] 31-Jan-2009 [3435] | What do you want to accomplish? |
Janko 31-Jan-2009 [3436] | =heading= |
[unknown: 5] 31-Jan-2009 [3437] | is that your answer? |
Janko 31-Jan-2009 [3438x6] | no .. I am writing example |
S WORKS IF IN THIS ORDER =heading= {comment some comment} - line 1 - line 2 -------------> <h1>heading</h1> <p>comment some comment</p> <li>line 1<li> <li>line 2</li> THIS DOESN'T WORK =heading= {comment some comment} =heading= - line 1 - line 2 =heading= {comment some comment} ADDITIONAL (SIMILAR) PROBLEM - line 1 + line 2 + line 3 - line 4 + line 5 -----------------> <li class="a">line 1</li> <li class="a">line 2</li> ... | |
------------> this arrow means that I convert that to that | |
basically it seems to me right now, PARSE is mega powerfull for anything that comes in somewhat PREDEFINED order, like dialects and many other things (I could do mulitple html extraction programs with it for some search project I was making without hitting this limitation - it was predefined order too).. but it seems to get limited at things that repeat/exchange themselves at random etc-- | |
ups my last example with lists was bad | |
again ADDITIONAL (SIMILAR) PROBLEM - line 1 + line 2 + line 3 - line 4 + line 5 -----------------> <li class="minus">line 1</li> <li class="plus">line 2</li> <li class="plus">line 3</li> <li class="minus">line 4</li> ... | |
Oldes 31-Jan-2009 [3444x3] | Complement: >> c1: charset "1" == make bitset! 64#{AAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=} >> find c1 "1" == true >> find c1 "2" == none >> c2: complement c1 == make bitset! 64#{/////////f////////////////////////////////8=} >> find c2 "2" == true >> find c2 "1" |
== none | |
>> ? complement USAGE: COMPLEMENT value DESCRIPTION: Returns the one's complement value. COMPLEMENT is an action value. ARGUMENTS: value -- (Type: logic number char tuple binary string bitset image) >> ? union USAGE: UNION set1 set2 /case /skip size DESCRIPTION: Creates a new set that is the union of the two arguments. UNION is a native value. ARGUMENTS: set1 -- first set (Type: series bitset) set2 -- second set (Type: series bitset) REFINEMENTS: /case -- Use case-sensitive comparison /skip -- Treat the series as records of fixed size size -- (Type: integer) >> | |
Janko 31-Jan-2009 [3447] | Oldes thanks, I have looked at docs of complement, but the fact is that I don't know the meaning of word itself "Returns the one's complement value." .. I imagine it returns everything except the values you give it, but that seems strange? |
Oldes 31-Jan-2009 [3448x3] | convert-input: func[input [string!] /local stops rest opened-tags b e][ probe input space: charset " ^-" stops: charset "-+^/" rest: complement stops opened-li?: false parse/all input [ some [ () ;<-- to be able escape from the parse loop if there is any infinite loop b: #"^/" e: ( if opened-li? [ e: change/part b "</li>^/" 1 opened-li?: false ] ) :e b: [ #"-" any space e: ( e: change/part b {<li class="minus">} e opened-li?: true ) | #"+" any space e: ( e: change/part b {<li class="plus">} e opened-li?: true ) ] :e | to #"^/" | end ] ] if opened-li? [ append input "</li>" ] input ] probe convert-input { - line 1 + line 2 + line 3 - line 4 + line 5} |
Now I see that the above example will require newline at start of the input. And that I'm not using the 'stops and 'rest at all:) | |
but is you use something like: any rest it will give you any chars which are not defined in the 'stops charset | |
older newer | first last |