Hi Charles,
I'm having trouble with this little program.
Specifically I got this error: UNIDENTIFIED OPERAND: GETWORD...
'ReadSpecificLine.o2bas
uses stringutil
new Textarray t
t.load "dati.txt"
print t.line 7
print t.lineCount
del t
Ciao
Hi Nicola,
There is a dependency here. Try uses ParseUtil instead of StringUtil.
Thanks Charles.
OK with PARSEUTIL.INC works correctly.
Anyway I wanted to tell you that the example I took from "ROSETTA CODE" ...
Maybe it needs to be corrected?
p.s.
I really appreciate your skills and knowledge.
Thanks Nicola,
I will fix this dependency by moving the StructuredText class from StringUtil.inc to ParseUtil.inc
Please, Charles,
could you tell me what are the "external" functions of PARSEUTIL.INC?
I would like to know them and include them in the HELP.
Ciao
Hi Nicola,
I'm reviewing ParseUtil.inc and I have removed if few functions which have never been used. The others are used directly or indirectly by Oxide, Co2 and LeanLisp. In the longer term, Parseutil may become merged with Oxygen's source code parsers: lexa.inc and lexi.inc.
I am also interested in developing a standard for embedded documentation from which html pages can be automatically generated, like Doxygen:
https://en.wikipedia.org/wiki/Doxygen
https://www.doxygen.nl/index.html
A typical Doxygen layout looks like this:
/**
<A short one line description>
<Longer description>
<May span multiple lines or paragraphs as needed>
@param Description of method's or function's input parameter
@param ...
@return Description of the return value
*/
I will post Parseutil as soon a I have completed the review.
Hi Charles,
excellent idea of using Doxygen. I read something from the link you entered.
In this way the source file would have all the notes necessary to explain it and, at the same time, could be used to create its part in the HELP.
Here is a sample: - playing with markup styles
function instrword(string s,k) as int
to find whole words in a string
Parameters:
s is the string to be searched
k is the keyword to be located in s
Return:
the index of the first position of k in s
if the search fails then the return value is 0
function instrword(string s,k) as int
=====================================
/**
to find whole words in a string
@param s is the string to be searched
@param k is the keyword to be located in s
@return the index of the first position of k in s
if the search fails then the return value is 0
**/
int lk=len k
int ,lb,rb
byte b at strptr(s)
if not k then return 0
int i=1
do
i=instr(i,s,k)
if i=0
return 0
endif
lb=i-1
rb=i+lk
if b[ rb ]<48
if i=1
return 1
elseif b[ lb ]<48
return i
endif
endif
i+=lk
loop
end function
Hi Nicola,
A reviewed and annotated ParseUtil.inc:
Great thing Charles,
but perhaps a broad revision is needed?
Unfortunately, doing a test I get an error.
use parseutil.inc
string s="Hi Charles"
print getword(s,2)
Anyway, the program description is great that way.
Ah yes, I cleaned up StringUtil.inc. Some of it was to solve a Rosetta code task but it was too specific for library code.