|
Tags: Replaced Manual revert |
Line 1: |
Line 1: |
| == ATTENTION == | | == ATTENTION == |
| '''Keep Out''' - This is my all things MediaWiki '''Nuke Test Site''' ... | | '''Keep Out''' - This is my all things MediaWiki '''Nuke Test Site''' ... |
|
| |
| {{CodeStart}}
| |
| a$ = {{Cl|_READFILE$|_ReadFile$}}({{Text|<nowiki>"internal\help\_HSB32__11132.txt"</nowiki>|#FFB100}})
| |
| {{Cl|REDIM|ReDim}} l$({{Text|0|#F580B1}})
| |
| {{Text|<nowiki>'ub& = Parseline&(a$,)</nowiki>|#919191}}
| |
| {{Text|<nowiki>'?test</nowiki>|#919191}}
| |
|
| |
| {{Cl|SUB|Sub}} {{Text|test|#55FF55}} (a##, b(), c) {{Cl|STATIC|Static}} {{Text|<nowiki>'gfuzgweuwfe</nowiki>|#919191}}
| |
| {{Cl|END SUB|End Sub}}
| |
|
| |
| {{Cl|FUNCTION|Function}} {{Text|test$|#55FF55}} (a##, b() {{Cl|AS|As}} {{Cl|LONG|Long}}, c) {{Cl|STATIC|Static}} {{Text|<nowiki>'gfuzgweuwfe</nowiki>|#919191}}
| |
| {{Cl|END FUNCTION|End Function}}
| |
|
| |
| {{Text|<nowiki>'--- docs\doc_GuiAppframe.bm\ParseLine.html</nowiki>|#919191}}
| |
| {{Text|<nowiki>'---------------------------------------------------------------------</nowiki>|#919191}}
| |
| {{Cl|FUNCTION|Function}} {{Text|ParseLine&|#55FF55}} (inpLine$, sepChars$, quoChars$, outArray$(), minUB&)
| |
| {{Text|<nowiki>'--- so far return nothing ---</nowiki>|#919191}}
| |
| {{Text|ParseLine&|#55FF55}} = {{Text|-1|#F580B1}}
| |
| {{Text|<nowiki>'--- init & check some runtime variables ---</nowiki>|#919191}}
| |
| ilen& = {{Cl|LEN|Len}}(inpLine$): icnt& = {{Text|1|#F580B1}}
| |
| {{Cl|IF|If}} ilen& = {{Text|0|#F580B1}} {{Cl|THEN|Then}} {{Cl|EXIT FUNCTION|Exit Function}}
| |
| slen% = {{Cl|LEN|Len}}(sepChars$)
| |
| {{Cl|IF|If}} slen% > {{Text|0|#F580B1}} {{Cl|THEN|Then}} s1% = {{Cl|ASC (function)|Asc}}(sepChars$, {{Text|1|#F580B1}})
| |
| {{Cl|IF|If}} slen% > {{Text|1|#F580B1}} {{Cl|THEN|Then}} s2% = {{Cl|ASC (function)|Asc}}(sepChars$, {{Text|2|#F580B1}})
| |
| {{Cl|IF|If}} slen% > {{Text|2|#F580B1}} {{Cl|THEN|Then}} s3% = {{Cl|ASC (function)|Asc}}(sepChars$, {{Text|3|#F580B1}})
| |
| {{Cl|IF|If}} slen% > {{Text|3|#F580B1}} {{Cl|THEN|Then}} s4% = {{Cl|ASC (function)|Asc}}(sepChars$, {{Text|4|#F580B1}})
| |
| {{Cl|IF|If}} slen% > {{Text|4|#F580B1}} {{Cl|THEN|Then}} s5% = {{Cl|ASC (function)|Asc}}(sepChars$, {{Text|5|#F580B1}})
| |
| {{Cl|IF|If}} slen% > {{Text|5|#F580B1}} {{Cl|THEN|Then}} slen% = {{Text|5|#F580B1}} {{Text|<nowiki>'max. 5 chars, ignore the rest</nowiki>|#919191}}
| |
| {{Cl|IF|If}} {{Cl|LEN|Len}}(quoChars$) > {{Text|0|#F580B1}} {{Cl|THEN|Then}} q1% = {{Cl|ASC (function)|Asc}}(quoChars$, {{Text|1|#F580B1}}): {{Cl|ELSE|Else}} q1% = {{Text|34|#F580B1}}
| |
| {{Cl|IF|If}} {{Cl|LEN|Len}}(quoChars$) > {{Text|1|#F580B1}} {{Cl|THEN|Then}} q2% = {{Cl|ASC (function)|Asc}}(quoChars$, {{Text|2|#F580B1}}): {{Cl|ELSE|Else}} q2% = q1%
| |
| oalb& = {{Cl|LBOUND|LBound}}(outArray$): oaub& = {{Cl|UBOUND|UBound}}(outArray$): ocnt& = oalb&
| |
| {{Text|<nowiki>'--- skip preceding separators ---</nowiki>|#919191}}
| |
| plSkipSepas:
| |
| flag% = {{Text|0|#F580B1}}
| |
| {{Cl|WHILE|While}} icnt& <= ilen& {{Cl|AND (boolean)|And}} {{Cl|NOT|Not}} flag%
| |
| ch% = {{Cl|ASC (function)|Asc}}(inpLine$, icnt&)
| |
| {{Cl|SELECT CASE|Select Case}} slen%
| |
| {{Cl|CASE|Case}} {{Text|0|#F580B1}}: flag% = {{Text|-1|#F580B1}}
| |
| {{Cl|CASE|Case}} {{Text|1|#F580B1}}: flag% = ch% <> s1%
| |
| {{Cl|CASE|Case}} {{Text|2|#F580B1}}: flag% = ch% <> s1% {{Cl|AND|And}} ch% <> s2%
| |
| {{Cl|CASE|Case}} {{Text|3|#F580B1}}: flag% = ch% <> s1% {{Cl|AND|And}} ch% <> s2% {{Cl|AND|And}} ch% <> s3%
| |
| {{Cl|CASE|Case}} {{Text|4|#F580B1}}: flag% = ch% <> s1% {{Cl|AND|And}} ch% <> s2% {{Cl|AND|And}} ch% <> s3% {{Cl|AND|And}} ch% <> s4%
| |
| {{Cl|CASE|Case}} {{Text|5|#F580B1}}: flag% = ch% <> s1% {{Cl|AND|And}} ch% <> s2% {{Cl|AND|And}} ch% <> s3% {{Cl|AND|And}} ch% <> s4% {{Cl|AND|And}} ch% <> s5%
| |
| {{Cl|END SELECT|End Select}}
| |
| icnt& = icnt& + {{Text|1|#F580B1}}
| |
| {{Cl|WEND|Wend}}
| |
| {{Cl|IF|If}} {{Cl|NOT|Not}} flag% {{Cl|THEN|Then}} {{Text|<nowiki>'nothing else? - then exit</nowiki>|#919191}}
| |
| {{Cl|IF|If}} ocnt& > oalb& {{Cl|GOTO|GoTo}} plEnd
| |
| {{Cl|EXIT FUNCTION|Exit Function}}
| |
| {{Cl|END IF|End If}}
| |
| {{Text|<nowiki>'--- redim to clear array on 1st word/component ---</nowiki>|#919191}}
| |
| {{Cl|IF|If}} ocnt& = oalb& {{Cl|THEN|Then}} {{Cl|REDIM|ReDim}} outArray$(oalb& {{Cl|TO|To}} oaub&)
| |
| {{Text|<nowiki>'--- expand array, if required ---</nowiki>|#919191}}
| |
| plNextWord:
| |
| {{Cl|IF|If}} ocnt& > oaub& {{Cl|THEN|Then}}
| |
| oaub& = oaub& + {{Text|10|#F580B1}}
| |
| {{Cl|REDIM|ReDim}} {{Cl|_PRESERVE|_Preserve}} outArray$(oalb& {{Cl|TO|To}} oaub&)
| |
| {{Cl|END IF|End If}}
| |
| {{Text|<nowiki>'--- get current word/component until next separator ---</nowiki>|#919191}}
| |
| flag% = {{Text|0|#F580B1}}: nest% = {{Text|0|#F580B1}}: spos& = icnt& - {{Text|1|#F580B1}}
| |
| {{Cl|WHILE|While}} icnt& <= ilen& {{Cl|AND (boolean)|And}} {{Cl|NOT|Not}} flag%
| |
| {{Cl|IF|If}} ch% = q1% {{Cl|AND (boolean)|And}} nest% = {{Text|0|#F580B1}} {{Cl|THEN|Then}}
| |
| nest% = {{Text|1|#F580B1}}
| |
| {{Cl|ELSEIF|ElseIf}} ch% = q1% {{Cl|AND (boolean)|And}} nest% > {{Text|0|#F580B1}} {{Cl|THEN|Then}}
| |
| nest% = nest% + {{Text|1|#F580B1}}
| |
| {{Cl|ELSEIF|ElseIf}} ch% = q2% {{Cl|AND (boolean)|And}} nest% > {{Text|0|#F580B1}} {{Cl|THEN|Then}}
| |
| nest% = nest% - {{Text|1|#F580B1}}
| |
| {{Cl|END IF|End If}}
| |
| ch% = {{Cl|ASC (function)|Asc}}(inpLine$, icnt&)
| |
| {{Cl|SELECT CASE|Select Case}} slen%
| |
| {{Cl|CASE|Case}} {{Text|0|#F580B1}}: flag% = (nest% = {{Text|0|#F580B1}} {{Cl|AND|And}} (ch% = q1%)) {{Cl|OR|Or}} (nest% = {{Text|1|#F580B1}} {{Cl|AND|And}} ch% = q2%)
| |
| {{Cl|CASE|Case}} {{Text|1|#F580B1}}: flag% = (nest% = {{Text|0|#F580B1}} {{Cl|AND|And}} (ch% = s1% {{Cl|OR|Or}} ch% = q1%)) {{Cl|OR|Or}} (nest% = {{Text|1|#F580B1}} {{Cl|AND|And}} ch% = q2%)
| |
| {{Cl|CASE|Case}} {{Text|2|#F580B1}}: flag% = (nest% = {{Text|0|#F580B1}} {{Cl|AND|And}} (ch% = s1% {{Cl|OR|Or}} ch% = s2% {{Cl|OR|Or}} ch% = q1%)) {{Cl|OR|Or}} (nest% = {{Text|1|#F580B1}} {{Cl|AND|And}} ch% = q2%)
| |
| {{Cl|CASE|Case}} {{Text|3|#F580B1}}: flag% = (nest% = {{Text|0|#F580B1}} {{Cl|AND|And}} (ch% = s1% {{Cl|OR|Or}} ch% = s2% {{Cl|OR|Or}} ch% = s3% {{Cl|OR|Or}} ch% = q1%)) {{Cl|OR|Or}} (nest% = {{Text|1|#F580B1}} {{Cl|AND|And}} ch% = q2%)
| |
| {{Cl|CASE|Case}} {{Text|4|#F580B1}}: flag% = (nest% = {{Text|0|#F580B1}} {{Cl|AND|And}} (ch% = s1% {{Cl|OR|Or}} ch% = s2% {{Cl|OR|Or}} ch% = s3% {{Cl|OR|Or}} ch% = s4% {{Cl|OR|Or}} ch% = q1%)) {{Cl|OR|Or}} (nest% = {{Text|1|#F580B1}} {{Cl|AND|And}} ch% = q2%)
| |
| {{Cl|CASE|Case}} {{Text|5|#F580B1}}: flag% = (nest% = {{Text|0|#F580B1}} {{Cl|AND|And}} (ch% = s1% {{Cl|OR|Or}} ch% = s2% {{Cl|OR|Or}} ch% = s3% {{Cl|OR|Or}} ch% = s4% {{Cl|OR|Or}} ch% = s5% {{Cl|OR|Or}} ch% = q1%)) {{Cl|OR|Or}} (nest% = {{Text|1|#F580B1}} {{Cl|AND|And}} ch% = q2%)
| |
| {{Cl|END SELECT|End Select}}
| |
| icnt& = icnt& + {{Text|1|#F580B1}}
| |
| {{Cl|WEND|Wend}}
| |
| epos& = icnt& - {{Text|1|#F580B1}}
| |
| {{Cl|IF|If}} {{Cl|ASC (function)|Asc}}(inpLine$, spos&) = q1% {{Cl|THEN|Then}} spos& = spos& + {{Text|1|#F580B1}}
| |
| outArray$(ocnt&) = {{Cl|MID$ (function)|Mid$}}(inpLine$, spos&, epos& - spos&)
| |
| ocnt& = ocnt& + {{Text|1|#F580B1}}
| |
| {{Text|<nowiki>'--- more words/components following? ---</nowiki>|#919191}}
| |
| {{Cl|IF|If}} flag% {{Cl|AND (boolean)|And}} ch% = q1% {{Cl|AND (boolean)|And}} nest% = {{Text|0|#F580B1}} {{Cl|GOTO|GoTo}} plNextWord
| |
| {{Cl|IF|If}} flag% {{Cl|GOTO|GoTo}} plSkipSepas
| |
| {{Cl|IF|If}} (ch% <> q1%) {{Cl|AND (boolean)|And}} (ch% <> q2% {{Cl|OR (boolean)|Or}} nest% = {{Text|0|#F580B1}}) {{Cl|THEN|Then}} outArray$(ocnt& - {{Text|1|#F580B1}}) = outArray$(ocnt& - {{Text|1|#F580B1}}) + {{Cl|CHR$|Chr$}}(ch%)
| |
| {{Text|<nowiki>'--- final array size adjustment, then exit ---</nowiki>|#919191}}
| |
| plEnd:
| |
| {{Cl|IF|If}} ocnt& - {{Text|1|#F580B1}} < minUB& {{Cl|THEN|Then}} ocnt& = minUB& + {{Text|1|#F580B1}}
| |
| {{Cl|REDIM|ReDim}} {{Cl|_PRESERVE|_Preserve}} outArray$(oalb& {{Cl|TO|To}} (ocnt& - {{Text|1|#F580B1}}))
| |
| {{Text|ParseLine&|#55FF55}} = ocnt& - {{Text|1|#F580B1}}
| |
| {{Cl|END FUNCTION|End Function}}
| |
| {{CodeEnd}}
| |
ATTENTION
Keep Out - This is my all things MediaWiki Nuke Test Site ...