• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp4382
r3wp44224
total:48606

results window for this page: [start: 23301 end: 23400]

world-name: r3wp

Group: Parse ... Discussion of PARSE dialect [web-public]
Ladislav:
14-Sep-2010
fine, I used your text, and added some more
Pekr:
15-Sep-2010
ah, there was USE 1 (BrianH) and USE 2 proposal (Peta). USE 1 was 
assigned for implementation, but deferred along with LIMIT, OF, REVERSE 
and some other proposals ...
Ladislav:
15-Sep-2010
Pekr, there are no "parse variables", as far as I know. My above 
code was inspired by BrianH and USE2
Pekr:
15-Sep-2010
I know, but I reacted upon Carl's recent blog, and if Carl dares 
to use the incorrect terminology, then I can too, no? :-)


This function is useful because PARSE rules often store data in variables 
which, depending on how you handle them, can be overwritten by rule 
recursion. (Which is done often in parsing.)
Ladislav:
15-Sep-2010
Regarding the above "three different variable types" - as far as 
the interpreter is concerned, there is no difference between the 
'start 'end and 'copy variables. You used them in a specific way, 
but, later, you can very well use another expression, where you write:

user: copy start to "whatever" etc.


So, you can easily see, that neither the 'start nor the 'user variable 
has any "variable type" you could infer based upon their usage in 
one specific expression.
Ladislav:
15-Sep-2010
err, I meant the 'start 'end and 'user variables
Ladislav:
15-Sep-2010
So, generally speaking, it may be useful for you to use some some 
variables only as "markers", but that "variable type" is something 
you impose just to make the things easy for you to handle. The interpreter 
does not (and should not) make such distinctions.
Ladislav:
15-Sep-2010
As I said, you can use some variables for specific purposes only, 
but that is your decision, and is not supported by any interpreter 
property, and certainly is not useful for all purposes. I may want 
to use some variables in more "roles" than you want to.
Pekr:
15-Sep-2010
and hence is probably a regular rebol level word, just used inside 
the parse dialect?
Ladislav:
15-Sep-2010
In my opinion, all of the above 'start 'end 'user and 'temp words 
are "regular" REBOL words, while e.g. the 'copy word above is actually 
a parse dialect keyword
Pekr:
15-Sep-2010
and - it was not nitpicking on your part - using the correct terminology 
where possible is important, as it helps to correctly interpret the 
way in which the language works. It is just lack of knowledge on 
my part, that I confuse the terms ... exactly because I often don't 
understand the internals ...
Izkata:
15-Sep-2010
start: :end and temp: would just be called set-words and get-words, 
either within the Parse dialect or the Do dialect (Do dialect being 
"rebol level")
Ladislav:
15-Sep-2010
Re start: and :start e.g. - they are values of different datatypes, 
but can be seen as just one variable.
Ladislav:
18-Sep-2010
Hi, I rewrote http://www.fm.tul.cz/~ladislav/rebol/evaluate.rto 
contain slightly more comments and to use the USE-RULE function, 
so that it now became a more complex example of its usage.
Ladislav:
18-Sep-2010
Pekr, knowing that you were interested in the subject as well, I 
sincerely hope, that you read the wikibook subsection, run the examples, 
and let me know what you are missing in the doc and in the functionality.
Claude:
20-Sep-2010
a get number, name and msg . is that possible ? and how ?
Maxim:
20-Sep-2010
is the data guaranteed to be rebol compatible?  (you can use 'LOAD 
on it and it will never return an erro)
Maxim:
20-Sep-2010
otherwise, you can just do a line by line parsing, filtering out 
"keywords" at the start and then loading the data after the ":"
Claude:
20-Sep-2010
but it is very strange. i heard that parse is very powerfull. and 
now i can't use it because if to difficult !!!!
Maxim:
20-Sep-2010
parse is very powerfull and easy to *use*  but *mastering* it isn't.
Claude:
20-Sep-2010
thank you i will test it and try to understand too ;-)
Maxim:
20-Sep-2010
using which rebol?  I did run it through and it worked ok on 2.7.7
Steeve:
20-Sep-2010
Much easier with R3.
assuming, 
>> src: {Number : 10017
Name       : Disable Message Partner
Application: MXS
Severity   : Info
Type       : Alarm Event
Date-Time  : 20/09/10 12:39:43
GMT        : Mon Sep 20 10:39:43 2010}

then, 


>> construct parse copy src [return while[and[some #" " #":"] remove[some 
#" "]| skip]]
== make object! [
    Number: "10017"
    Name: "Disable Message Partner"
    Application: "MXS"
    Severity: "Info"
    Type: "Alarm Event"
    Date-Time: "20/09/10 12:39:43"
    GMT: "Mon Sep 20 10:39:43 2010"
]
Maxim:
20-Sep-2010
claude it might be because of copy/pasting... you are on linux.. 
did you just copy the code and paste it into the console?
Maxim:
20-Sep-2010
the best is to copy it to a file and run it.
Maxim:
20-Sep-2010
I just (re)tried it and it does work on my system...
Claude:
20-Sep-2010
well i on linux and on linux altme do work well with ctrl-c !!!!!
Maxim:
20-Sep-2010
but here we are parsing and any character code has to be loaded properly.. 
in theory it should work.. but it seems not...

add this just before the ":"

		here:
		(probe copy/part here 20)


it will print what is exactly at that point ... may provide clues 
as to why the ":" isn't matching...
Claude:
20-Sep-2010
i do a copy/paste http://host4.altme.com/altweb/rebol3/chat210.html
into a file.r  and i execut it . i have got the same error
Anton:
20-Sep-2010
Ways to identify the problem:

- In AltME, copy Max's entire post which contains the code. You can 
do this with a right click when no text is selected in the message.

  Switch to the rebol console and type:   checksum read clipboard:// 
     and tell us what you get.

- Then you can also type:  print mold read clipboard://    and examine 
what is printed carefully.

- Try to reproduce the problem with shorter code and shorter input. 
Two lines of input should do.
Anton:
21-Sep-2010
(I don't always see consistent behaviour with AltME and rebol on 
linux, by the way.)
Claude:
21-Sep-2010
and check it with nagios
Claude:
21-Sep-2010
if you have time to show me how i am ok. but for now i must take 
my children to school and go to work. thanks a lot again
Maxim:
21-Sep-2010
basically you have to create two complete (& and alternate) rule 
structures. and separate them with an "|" .


but you have to be sure that the first rule doesn't "pre-empt" the 
second one.... meaning that the first rule must not also match the 
second rule, or else, you will never reach the second rule.
Maxim:
21-Sep-2010
for example..

some [["a" | "aa"]]


here we will never reach "aa" because "a" will be satisfied and the 
alternative will never be attempted ... so instead of matching "aa" 
you'd always match "a" twice .
Maxim:
21-Sep-2010
where as specifying [some ["aa" | "a"]]  will always match "aa" IF 
there is still more than one "a" to parse... and will only ever reach 
"a" if the sequence is an odd number of "a" characters (or just one, 
obviously).


so "aaaa"  will match the "aa" rule twice, and "aaa"  will  match 
 "aa" then "a" .
Maxim:
21-Sep-2010
IMHO, this is the basic premise of all of parse.   once you really 
understand how this applies to a rule which has sub rules... you 
really understand parse.... and then you can start doing more funky 
stuff.
Sunanda:
18-Oct-2010
Regexlib has a different ISO-8601 date matching regex:
    http://regexlib.com/REDetails.aspx?regexp_id=2092

And the ability to enter any regex and target strings to test what 
happens:
    http://regexlib.com/RETester.aspx?
GrahamC:
18-Oct-2010
and it seems my string is passing ... hmm
GrahamC:
18-Oct-2010
I'm trying to validate some XML against an online validator and it's 
rejecting my dates :(
Ladislav:
18-Oct-2010
R3 can let you define that typeset and use it any time you like
AdrianS:
18-Oct-2010
Graham, try http://gskinner.com/RegExrfor working out regexes. It 
has a really nice UI where you can hover over the components of the 
regex and see exactly what they do.
Sunanda:
4-Nov-2010
Question on StackOverflow.....there must be a better answer than 
mine, and I'd suspect it involves PARSE (better answers usually do:)

    http://stackoverflow.com/questions/4093714/is-there-finer-granularity-than-load-next-for-reading-structured-data
Gabriele:
5-Nov-2010
also, Carl's clean-script and script colorizer use parse + load/next 
to do the same thing. my Wetan uses the same method.
Gabriele:
5-Nov-2010
basically, as long as you skip over [, (, ), and ] you can just use 
load/next. I'm also skipping over #[ because I want to preserve literal 
values while formatting (that is, preserve what the user typed)
Oldes:
1-Dec-2010
How to use the new INTO parse keyword? Could it be used to avoid 
the temp parse like in this (very simplified example)?

  parse "<a>123</a>" [thru "<a>" copy tmp to "</a>" (probe tmp  probe 
  parse tmp ["123"]) to end]

Note that I know that in this example it's easy to use just one parse 
and avoid the temp.
Ladislav:
1-Dec-2010
You can take advantage of using it when parsing a block and needing 
to parse a subblock (of any-block! type) or a substring
Oldes:
1-Dec-2010
And is there any nice solution for my string parsing above? I can 
live with the temps, just was thinking if it could be done better.. 
anyway, at least I know how to use INTO:)
Ladislav:
1-Dec-2010
For comparison, a similar rule can be written as follows:

some [
	thru {<h2><a} thru ">" copy name to {<}
	copy doc any [
		and {^/ </div>} break
		| thru {<pre class="code">} copy code to {</pre} (
	          	probe name
	      		probe code
	       	)
			any [
	            thru {<h5>} copy arg to {<}
	            thru {<ol><p>} copy arg-desc to {</p></ol>}
	            (printf ["  * " 10 " - "] reduce [arg arg-desc])
	  		]
  		| skip
	]
]
Oldes:
1-Dec-2010
That's not correct.. there is a reason for the temp parse and that's 
here because thru "<h5" would skip out of the div.
Ladislav:
1-Dec-2010
aha, I missed there should be doc-start and doc-end
BrianH:
1-Dec-2010
I like your solution, and would use solutions like that. I just would 
prefer to have LIMIT :)
BrianH:
1-Dec-2010
You have to be careful with INTO string though because there is a 
lot of PARSE code out there that depended on INTO failing with non-blocks, 
and triggering an alternation. Learn to like AND type INTO if your 
code depends on that.
BrianH:
1-Dec-2010
If it is not restored automatically on failure, backtracking and 
alternation, then that is a problem that needs a ticket submitted 
for it.
BrianH:
1-Dec-2010
Right now it is a stack of integers (position) and a single pointer 
(series reference). To do this it would need to be a stack of series 
references too, and the collector would need to be informed of its 
exdistence so it could scan it for references.
BrianH:
1-Dec-2010
One interesting thing is that you can switch from string to block 
parsing and back mid-rule using series switching :)
BrianH:
1-Dec-2010
Yup, that would be preferred. And please mention that in a ticket 
comment to #1787 :)
BrianH:
1-Dec-2010
Otherwise I will mention this in a comment and attribute the idea 
to you :)
Ladislav:
2-Dec-2010
I just wanted to make sure to point at INTO, since it is already 
implemented, and working fine.
Ladislav:
2-Dec-2010
(and doing the same thing, at least in principle)
BrianH:
2-Dec-2010
Yes, and a good point it was too.
BrianH:
2-Dec-2010
Steeve, I'm sure that the reason it was so easy for me to come up 
with workarounds off the top of my head on a weak-brain day was because 
I had seen them before when you pointed them out and didn't remember 
it directly. In any case, I'm sure your stuff was great.
Oldes:
2-Dec-2010
Steeve, Ladislav... sorry, but your version is not working. The main 
SOME rule finds only one match and than stops. Maybe I should give 
you a simple test string so you could test it first.
Ladislav:
2-Dec-2010
since OPT was needed, it is provable, that the "inner parse" fails 
sometimes, which does not look desirable, and may provoke your attention, 
Oldes
Steeve:
14-Jan-2011
I'm working on an incremental lexer able to perform line-by-line 
analysis of any plain text documents.

the idea is to allow editing without having to reparse all the document.

The syntactical rules will be regular parse rules easy to understand 
and to modify, to facilitate
the creation of different model of document.

Of course, the first target is a rebol parser, but the make-doc format 
is also in my short range.

If anyone already have deep thoughts about the subject, please share 
your opinions.
I will come with a proto soon enough.
Steeve:
14-Jan-2011
you  don't need to, just use the /error refinemeent with transcode.
>> transcode/next/error
and you get an error object if any
shadwolf:
14-Jan-2011
and this how i use transcode in it ? instead of load/next here ? 
>> error? set/any [value end] try [load/next start]
Gregg:
26-Feb-2011
If it's a patterns page, it shouldn't be R3 specific. If patterns 
require different implementations in R2 and R3, those can be filled 
in, or stubbed out with a note as to why it is either not needed 
or not worth the effort in one version or the other.
BrianH:
26-Feb-2011
Every pattern should have an R2 and R3 version, with explanations.
Geocaching:
11-Mar-2011
Hello, I am struggling to build a parser of equation. The idea is 
a function who would take sth like "SQRT(1-x^2)/(1-x)^3" and return 
a block of rebol code: [divide square-root subtract 1 power x 2 power 
subtract 1 x 3].
Anyone has done it already?
Gregg:
11-Mar-2011
I know Gabriele has done something along those lines, and I'm sure 
others have as well. I don't know of any that return REBOL code. 
Can you be more specific about what problems you're having?
Geocaching:
14-Mar-2011
Hello, I put a new version of my parse-equation.r script on rebol.org: 
the parser engine is now completed and finalized. I improved the 
recursive implementation to make the code much more readable, understandable 
and elegant. Future improvements should be now limited to adding 
new math functions and a syntax error handling to return usefull 
error messages to the user when she/he makes a syntax error in the 
equation.  http://www.rebol.org/view-script.r?script=parse-equation.r
Geocaching:
14-Mar-2011
And i am not sure how to implement signed numbers... Usinfg the minus 
sign introduces a level of complexiy I want to avaoid in the code. 
I might decide to force the use of a function like neg()... I am 
still thinking about it...
Geocaching:
14-Mar-2011
Hello sqlab... Signed numbers and signed sub-expression are now properly 
handled :)
>> parse-equation "+(1+-x)**-sqrt(-1--x)"

== [power add 1.0 negate x negate square-root subtract -1.0 negate 
x]

Thanks for pointing my attention to this issue.

http://www.rebol.org/view-script.r?script=parse-equation.r
Endo:
15-Mar-2011
Oh and English comments in the source code please, if possible :)
Group: !RebGUI ... A lightweight alternative to VID [web-public]
OneTom:
30-Oct-2005
i wrote a little csveditor and this is the last thing i need to release 
it as a useful app
OneTom:
30-Oct-2005
and im curious about that wether it contains any extension capabilities 
or not or im just too blind to recognize it
Volker:
30-Oct-2005
and i got the url from desktop. when i go up, it adds %../ , when 
i go back, the folder, up again an so on.
OneTom:
30-Oct-2005
i programmed turbovision and delphi earlier, so its the usual "overriding 
a virtual method trick"
Volker:
30-Oct-2005
and to avoid clashing (subclassing some levels deep, at every level 
old-engage: :engage) i prefix with area^
Volker:
30-Oct-2005
My first workaround checks if face is focused and does nothing then. 
but when you put something in face, this code should be activated 
on show.
OneTom:
30-Oct-2005
hmm.. ive tried to use this rebgui stuff for the 1st time for a real 
problem, but it look buggy. a table cant be focused by tab (in spite 
of append ctx-rebgui/edit/tabbed 'table), a row in a table cant b 
focused by the program in an obvious way. the dropdown list doesnt 
rolls up after dropping down and it doesnt drops down if i click 
on its text.
Graham:
30-Oct-2005
rebgui-widgets.r and also rebgui-edit.r ?
Volker:
31-Oct-2005
Hmm, maybe i changed something else too. IIRC there was some problem 
with offset-to-caret somewhere. The fix to my fix is that one line, 
and defixing my change in %rebgui-widgets.r
Graham:
31-Oct-2005
gee... I'm confused.  I put that line in the engage function after 
the switch and nothing happens.
Volker:
31-Oct-2005
and the download.r there.
Graham:
31-Oct-2005
I ran download.r and it started up tour.r    ...was it supposed to 
do that?
Volker:
31-Oct-2005
And it does not scroll when caret moves out.
Volker:
31-Oct-2005
He did and extended it, says the header. And made some wrong changes 
maybe. Maybe he got made because of the offset-to-caret-bug.
james_nak:
1-Nov-2005
How do you get a face to come to the forefront? After I've "displayed" 
it and say, go and click on some other window, how do I get the initial 
face to pop back up. In my case, I have a table of data and when 
the user clicks it, I want to have a more detailed view of that line 
of data.
Graham:
1-Nov-2005
Display is missing an options refinement.  I added one to 'display, 
and altered the view to this

			view/new/options view-face opts
		][
			view/new view-face
		]
Graham:
2-Nov-2005
Cool... that works.  I can now get a png of the layout and dump to 
the filing system.
Ashley:
3-Nov-2005
Yep, just catching up with 5 weeks of snail mail and REBOL3 AltME 
messages ... should take another day.
Graham:
3-Nov-2005
Just to get you up to speed, I think the major problem to fix is 
the editor in the area.  To fix : cursor keys, and pageup/down behaviour 
especially at boundary, and also cr behaviour.  Highlighting is also 
problematic.
Graham:
3-Nov-2005
Also, need accessors to set radio buttons, and to move the cursor 
in a table, including selecting mulitple rows (oneTom)
Graham:
4-Nov-2005
Oh, and request-file needs the /keep refinement restored.
Graham:
5-Nov-2005
Another problem - RT's request-dir traps when you try to access a 
directory that is not available, but RebGui's crashes.  And it can't 
be trapped with a try block at the request-dir level.
Graham:
6-Nov-2005
Let me read and see if any are missed ..
Ashley:
6-Nov-2005
Added Czech dictionary file (see http://www.dobeash.com/it/rebgui/roadmap.html) 
and dat files provided by Bobik (see http://www.dobeash.com/files/CzechWin.dat
and http://www.dobeash.com/files/CzechLinux.datfor different char 
encodings - win-1250 & ISO-8859-2 respectively).
Graham:
6-Nov-2005
Is the group-box a functional grouping?  I'd prefer that tabbing 
moves to the next group box and not recycle within the same group
23301 / 4860612345...232233[234] 235236...483484485486487