mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-01 12:40:36 +00:00
Reduces repeated code in routine to find SUB/FUNCTION names (IDE).
This commit is contained in:
parent
5b7c241ac4
commit
a23bbb8927
|
@ -896,14 +896,7 @@ FUNCTION ide2 (ignore)
|
||||||
END IF
|
END IF
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
'attempt to cleanse sfname$, just in case there are any comments or other unwanted stuff
|
cleanSubName sfname$
|
||||||
FOR CleanseSFNAME = 1 TO LEN(sfname$)
|
|
||||||
SELECT CASE MID$(sfname$, CleanseSFNAME, 1)
|
|
||||||
CASE " ", "'", ":"
|
|
||||||
sfname$ = LEFT$(sfname$, CleanseSFNAME - 1)
|
|
||||||
EXIT FOR
|
|
||||||
END SELECT
|
|
||||||
NEXT
|
|
||||||
|
|
||||||
'update title of main window
|
'update title of main window
|
||||||
GOSUB UpdateTitleOfMainWindow
|
GOSUB UpdateTitleOfMainWindow
|
||||||
|
@ -2680,20 +2673,13 @@ FUNCTION ide2 (ignore)
|
||||||
IF x THEN
|
IF x THEN
|
||||||
n$ = RTRIM$(LEFT$(a$, x - 1))
|
n$ = RTRIM$(LEFT$(a$, x - 1))
|
||||||
args$ = RIGHT$(a$, LEN(a$) - x + 1)
|
args$ = RIGHT$(a$, LEN(a$) - x + 1)
|
||||||
|
x = INSTR(args$, ")"): IF x THEN args$ = LEFT$(args$, x)
|
||||||
ELSE
|
ELSE
|
||||||
n$ = a$
|
n$ = a$
|
||||||
args$ = ""
|
args$ = ""
|
||||||
|
cleanSubName n$
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
'attempt to cleanse n$, just in case there are any comments or other unwanted stuff
|
|
||||||
FOR CleanseN = 1 TO LEN(n$)
|
|
||||||
SELECT CASE MID$(n$, CleanseN, 1)
|
|
||||||
CASE " ", "'", ":"
|
|
||||||
n$ = LEFT$(n$, CleanseN - 1)
|
|
||||||
EXIT FOR
|
|
||||||
END SELECT
|
|
||||||
NEXT
|
|
||||||
|
|
||||||
backupn$ = n$
|
backupn$ = n$
|
||||||
|
|
||||||
DO UNTIL alphanumeric(ASC(RIGHT$(n$, 1)))
|
DO UNTIL alphanumeric(ASC(RIGHT$(n$, 1)))
|
||||||
|
@ -8197,7 +8183,7 @@ SUB ideshowtext
|
||||||
manualList = -1
|
manualList = -1
|
||||||
listOfCustomKeywords$ = LEFT$(listOfCustomKeywords$, customKeywordsLength)
|
listOfCustomKeywords$ = LEFT$(listOfCustomKeywords$, customKeywordsLength)
|
||||||
FOR y = 1 TO iden
|
FOR y = 1 TO iden
|
||||||
a$ = UCASE$(LTRIM$(RTRIM$(idegetline(y))))
|
a$ = UCASE$(_TRIM$(idegetline(y)))
|
||||||
sf = 0
|
sf = 0
|
||||||
IF LEFT$(a$, 4) = "SUB " THEN sf = 1
|
IF LEFT$(a$, 4) = "SUB " THEN sf = 1
|
||||||
IF LEFT$(a$, 9) = "FUNCTION " THEN sf = 2
|
IF LEFT$(a$, 9) = "FUNCTION " THEN sf = 2
|
||||||
|
@ -8216,16 +8202,9 @@ SUB ideshowtext
|
||||||
x = INSTR(a$, "(")
|
x = INSTR(a$, "(")
|
||||||
IF x THEN
|
IF x THEN
|
||||||
a$ = RTRIM$(LEFT$(a$, x - 1))
|
a$ = RTRIM$(LEFT$(a$, x - 1))
|
||||||
|
ELSE
|
||||||
|
cleanSubName a$
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
'attempt to cleanse n$, just in case there are any comments or other unwanted stuff
|
|
||||||
FOR CleanseN = 1 TO LEN(a$)
|
|
||||||
SELECT CASE MID$(a$, CleanseN, 1)
|
|
||||||
CASE " ", "'", ":"
|
|
||||||
a$ = LEFT$(a$, CleanseN - 1)
|
|
||||||
EXIT FOR
|
|
||||||
END SELECT
|
|
||||||
NEXT
|
|
||||||
listOfCustomKeywords$ = listOfCustomKeywords$ + "@" + removesymbol2$(a$) + "@"
|
listOfCustomKeywords$ = listOfCustomKeywords$ + "@" + removesymbol2$(a$) + "@"
|
||||||
END IF
|
END IF
|
||||||
NEXT
|
NEXT
|
||||||
|
@ -8889,19 +8868,13 @@ FUNCTION idesubs$
|
||||||
IF x THEN
|
IF x THEN
|
||||||
n$ = RTRIM$(LEFT$(a$, x - 1))
|
n$ = RTRIM$(LEFT$(a$, x - 1))
|
||||||
args$ = RIGHT$(a$, LEN(a$) - x + 1)
|
args$ = RIGHT$(a$, LEN(a$) - x + 1)
|
||||||
|
x = INSTR(args$, ")"): IF x THEN args$ = LEFT$(args$, x)
|
||||||
ELSE
|
ELSE
|
||||||
n$ = a$
|
n$ = a$
|
||||||
args$ = ""
|
args$ = ""
|
||||||
END IF
|
|
||||||
|
|
||||||
'attempt to cleanse n$, just in case there are any comments or other unwanted stuff
|
cleanSubName n$
|
||||||
FOR CleanseN = 1 TO LEN(n$)
|
END IF
|
||||||
SELECT CASE MID$(n$, CleanseN, 1)
|
|
||||||
CASE " ", "'", ":"
|
|
||||||
n$ = LEFT$(n$, CleanseN - 1)
|
|
||||||
EXIT FOR
|
|
||||||
END SELECT
|
|
||||||
NEXT
|
|
||||||
|
|
||||||
'If the user currently has the cursor over a SUB/FUNC name, let's highlight it
|
'If the user currently has the cursor over a SUB/FUNC name, let's highlight it
|
||||||
'instead of the currently in edition, for a quick link functionality:
|
'instead of the currently in edition, for a quick link functionality:
|
||||||
|
@ -13522,17 +13495,9 @@ SUB IdeMakeContextualMenu
|
||||||
n$ = RTRIM$(LEFT$(a$, x - 1))
|
n$ = RTRIM$(LEFT$(a$, x - 1))
|
||||||
ELSE
|
ELSE
|
||||||
n$ = a$
|
n$ = a$
|
||||||
|
cleanSubName n$
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
'attempt to cleanse n$, just in case there are any comments or other unwanted stuff
|
|
||||||
FOR CleanseN = 1 TO LEN(n$)
|
|
||||||
SELECT CASE MID$(n$, CleanseN, 1)
|
|
||||||
CASE " ", "'", ":"
|
|
||||||
n$ = LEFT$(n$, CleanseN - 1)
|
|
||||||
EXIT FOR
|
|
||||||
END SELECT
|
|
||||||
NEXT
|
|
||||||
|
|
||||||
n2$ = n$
|
n2$ = n$
|
||||||
IF LEN(n2$) > 1 THEN
|
IF LEN(n2$) > 1 THEN
|
||||||
DO UNTIL alphanumeric(ASC(RIGHT$(n2$, 1)))
|
DO UNTIL alphanumeric(ASC(RIGHT$(n2$, 1)))
|
||||||
|
@ -14875,5 +14840,11 @@ FUNCTION removesymbol2$ (varname$)
|
||||||
removesymbol2$ = LEFT$(varname$, i - 1)
|
removesymbol2$ = LEFT$(varname$, i - 1)
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
||||||
|
SUB cleanSubName (n$)
|
||||||
|
x = INSTR(n$, "'"): IF x THEN n$ = LEFT$(n$, x - 1)
|
||||||
|
x = INSTR(n$, ":"): IF x THEN n$ = LEFT$(n$, x - 1)
|
||||||
|
x = INSTR(n$, " "): IF x THEN n$ = LEFT$(n$, x - 1)
|
||||||
|
END SUB
|
||||||
|
|
||||||
'$INCLUDE:'wiki\wiki_methods.bas'
|
'$INCLUDE:'wiki\wiki_methods.bas'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue