World: r3wp
[Parse] Discussion of PARSE dialect
older newer | first last |
Graham 30-Jun-2008 [2601x2] | rule: [ copy d thru digits .... ] |
He's using string parsing .. not block parsing | |
[unknown: 5] 30-Jun-2008 [2603] | yeah can't use set then. |
amacleod 30-Jun-2008 [2604] | I'll try that Graham. Thanks |
Graham 30-Jun-2008 [2605x3] | or |
non-digits: complement digit parse [ copy digit-text to non-digits copy text to newline skip ] | |
and correct syntax helps :) | |
[unknown: 5] 30-Jun-2008 [2608x2] | >> str: "193920347REBOL ROCKS!^/" == "193920347REBOL ROCKS!^/" >> parse str compose [some (charset "0123456789") text: copy text thru newline] == true >> text == "REBOL ROCKS!^/" |
Something like that? | |
Brock 30-Jun-2008 [2610] | he was looking for the number and the string though. |
amacleod 30-Jun-2008 [2611x2] | No I have a text document with section numbers in front: 2. Hello 2.1 Hello Again 2.1.1 Hello already 3. Goodbye I want the section number inclued in hte copy |
It need not be included in hte same copy just as long as I can record it. | |
[unknown: 5] 30-Jun-2008 [2613] | So you just want each line then really? |
amacleod 30-Jun-2008 [2614x2] | Well it gets a little more complicated. some parts of the docment will be multilined. |
I thought it would be a simple thing that I was missing. I may need to re-think the formatting of the document. | |
[unknown: 5] 30-Jun-2008 [2616x2] | So even if something is multiline you would still want each line of the multiline correct? |
Or do you mean a multiline might looks something like this: 2.1 Hello Goodbye Where the second line doesn't have the preceeding number? | |
amacleod 30-Jun-2008 [2618] | Yes and formating may need to be retained |
[unknown: 5] 30-Jun-2008 [2619] | Ahhh yes that gets a bit more complicated. |
amacleod 30-Jun-2008 [2620] | Paul, while you are there... I was considering using Tretbase for this project |
[unknown: 5] 30-Jun-2008 [2621] | Excellent choise ;-) |
amacleod 30-Jun-2008 [2622] | Let me briefly explain where I'm going to see if you think its workable or perhaps a there is a better solution |
[unknown: 5] 30-Jun-2008 [2623] | k |
amacleod 30-Jun-2008 [2624x5] | I trying to put a set of Fire department related materials online. THey are now in pdf |
I'm converting them to text and reformatting them to parse | |
I want to hold each section in a seperate database record | |
So I can index for keywords and search and read only thse sections I need. | |
Photos and diagrams will also be stored. | |
[unknown: 5] 30-Jun-2008 [2629x4] | Well, TRETBASE 1.0 is the only finished product right now. So the only available TRETBASE app is 1.0 which is really not a multi-user solution. |
It might work for you if you not in need of multi-user (simultaenous access) | |
The next version of TRETBASE which is in work is multi-user and supports indexing. | |
But not finished. | |
amacleod 30-Jun-2008 [2633] | I'm using mysql for the online component but I need a local storage method too for offline use |
[unknown: 5] 30-Jun-2008 [2634] | It might work for that. Can also do the images conversion for you in REBOL format which is nice. |
amacleod 30-Jun-2008 [2635x2] | That was one of the things that had me thinking of using it. |
What I would need is a simple method to sync them | |
[unknown: 5] 30-Jun-2008 [2637] | Best thing to do is try it out as it really takes very little time to setup and try and you will know probably if it is suitable for you in about 10 minutes. |
amacleod 18-Jul-2008 [2638] | Is there a difference between a "space" and a "tab"? Can you parse for tab and not sapce? |
Graham 18-Jul-2008 [2639x2] | I would think you would have to parse/all .. and a space is #" " and a tab is #"^-" |
or you can use charsets | |
amacleod 18-Jul-2008 [2641] | Parse/all...works thanks |
Henrik 18-Jul-2008 [2642x2] | amacleod, small tip: |
help char! | |
amacleod 18-Jul-2008 [2644] | thanks |
btiffin 21-Aug-2008 [2645] | A long time ago, I offered to try a lecture. Don't feel worthy. So I thought I'd throw out a few (mis)understandings and have them corrected to build up a level of comfort that I wouldn't be leading a group of high potential rebols down a garden path. So; one of the critical mistakes in PARSE can be remembered as "so many", or a butchery of some [ any [ , so many. some asks for a truth among alternatives and any say's "yep, got zero of the thing I was looking for", but doesn't consume anything. SOME says, great and then asks for a truth. ANY say "yep, got zero of the thing I was looking for", and still doesn't move, ready to answer yes to every question SOME can ask. An infinite PARSE loop. Aside: to protect against infinite loops always start a fresh PARSE block with [() the "immediate block" of the paren! will allow for a keyboard escape, and not the more drastic Ctrl-C. So, I'd like to ask the audience; what other PARSE command sequences can cause infinite loops? end? and is it only "end", "to end" but "thru end" will alleviate that one? end end end end being true? >> parse "" [some [() end end end]] (escape) >> parse "" [some [() thru end end end]] == false >> parse "" [some [() to end end end]] (escape) >> Ok, but thru end is false. Is there an idiom to avoid looping on end, but still being true on the first hit? Other trip ups? |
Oldes 21-Aug-2008 [2646x3] | >> parse "" [any [()]] (escape) |
it's one of the most simple ways how to halt rebol if you don't include the parens. | |
These condition are already fixed in R3 | |
Louis 20-Sep-2008 [2649] | x: "12---dflksdf+++fhkw---sd+++sad" How can I remove everything to "---" thru "+++" to end up with "12fhkwsad" |
Anton 20-Sep-2008 [2650] | parse x [any [to "---" here: thru "+++" there: (remove/part here there) :here]] |
older newer | first last |