Skip to content

Commit

Permalink
basic-macro: cosmetic clean-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
jayrm committed Sep 6, 2020
1 parent e1a25ee commit e371a33
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/compiler/hlp-str.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1298,14 +1298,12 @@ sub hSplitStr(byref txt as string, byref del as string, res() as string)
p += 1
loop
res(cnt) = mid(txt, dpos(cnt - 1) + dellen)

end sub

'':::::
function hStr2Tok(byval txt as const zstring ptr, res() as string) as integer

var items = 10

var t = 0
var lc = 32UL
var s = cast(const ubyte ptr, txt)
Expand Down
12 changes: 9 additions & 3 deletions src/compiler/pp-define.bas
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ private function hLoadMacro _
function = -1

var hasParens = false


'' we don't know if this paren is the start of the argument list
'' or is part of the expression for the first argument.

'' '('?
if( lexCurrentChar( TRUE ) = CHAR_LPRNT ) then
hasParens = true
Expand Down Expand Up @@ -290,7 +293,7 @@ private function hLoadMacro _
text += QUOTE
else
'' If it's empty, produce an empty string ("")
text += """"""
text += QUOTE + QUOTE
end if

'' ordinary text..
Expand Down Expand Up @@ -672,6 +675,9 @@ private function hLoadMacroW _
DWstrConcatAssign( text, "$" + QUOTE )
DWstrConcatAssign( text, *hReplaceW( argtext, QUOTE, QUOTE + QUOTE ) )
DWstrConcatAssign( text, QUOTE )
else
'' If it's empty, produce an empty string ("")
DWstrConcatAssign( text, QUOTE + QUOTE )
end if

'' ordinary text..
Expand Down Expand Up @@ -750,7 +756,7 @@ private function hLoadDefineW _
DWstrAssign( lex.ctx->deftextw, *text.data + *lex.ctx->defptrw )
end if

lgt = len( *text.data )
lgt = len( *text.data )

'' just load text as-is
else
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/symb-define.bas
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ private function hDefJoin_cb( byval argtb as LEXPP_ARGTB ptr, byval errnum as in
ZstrFree(l)
ZstrFree(r)

function = res
function = res

end function

Expand Down

0 comments on commit e371a33

Please sign in to comment.