home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 49
/
Amiga_Dream_49.iso
/
atari
/
texte
/
oribin.zoo
/
bindings
/
go-match.fun
< prev
next >
Wrap
Text File
|
1991-07-09
|
4KB
|
174 lines
{{{ comments
; Jump from [,{ or ( to a matching ],} or ).
; if no match can be found, a errormessage appears.
}}}
nodup
{{{ libs
{{{F pre-char.fun
:::F pre-char.fun
}}}
{{{F error.fun
:::F error.fun
}}}
}}}
{{{ goto-matching-fence
{{{ next_char op
(deffun next_char (
O_RIGHT
if test-end-line (
{{{ next textline
do (
O_DOWN
if test-fold-line (
O_OPEN_FOLD
) else (
if test-end-fold (O_CLOSE_FOLD) fi
) fi
)
while and(not(test-bottom),not(test-text))
O_START_OF_LINE
}}}
) fi
))
}}}
(deffun goto-matching-fence (
if not(test-text) (oops) fi
store-line matching-fence-y
store-pos matching-fence-x
case
{{{ {
(test-char "{ (
set-counter fence-counter 1
do (
{{{ check one character
next_char
if test-char "{ (
add-counter fence-counter 1
) else (
if test-char "} (add-counter fence-counter -1) fi
) fi
}}}
) while and(not(test-bottom),not(counter-0 fence-counter))
{{{ not found ?
if test-bottom (
goto-line-counter matching-fence-y
goto-counter matching-fence-x
failed
) fi
}}}
))
}}}
{{{ }
(test-char "} (
set-counter fence-counter 1
do (
{{{ check one character
previous-text-character
if test-char "} (
add-counter fence-counter 1
) else (
if test-char "{ (add-counter fence-counter -1) fi
) fi
}}}
) while and(not(counter-0 fence-counter),not(test-top))
{{{ not found ?
if test-top (
goto-line-counter matching-fence-y
goto-counter matching-fence-x
failed
) fi
}}}
))
}}}
{{{ [
(test-char "[ (
set-counter fence-counter 1
do (
{{{ check one character
next_char
if test-char "[ (
add-counter fence-counter 1
) else (
if test-char "] (add-counter fence-counter -1) fi
) fi
}}}
) while and(not(test-bottom),not(counter-0 fence-counter))
{{{ not found ?
if test-bottom (
goto-line-counter matching-fence-y
goto-counter matching-fence-x
failed
) fi
}}}
))
}}}
{{{ ]
(test-char "] (
set-counter fence-counter 1
do (
{{{ check one character
previous-text-character
if test-char "] (
add-counter fence-counter 1
) else (
if test-char "[ (add-counter fence-counter -1) fi
) fi
}}}
) while and(not(counter-0 fence-counter),not(test-top))
{{{ not found ?
if test-top (
goto-line-counter matching-fence-y
goto-counter matching-fence-x
failed
) fi
}}}
))
}}}
{{{ (
(test-char "( (
set-counter fence-counter 1
do (
{{{ check one character
next_char
if test-char "( (
add-counter fence-counter 1
) else (
if test-char ") (add-counter fence-counter -1) fi
) fi
}}}
) while and(not(test-bottom),not(counter-0 fence-counter))
{{{ not found ?
if test-bottom (
goto-line-counter matching-fence-y
goto-counter matching-fence-x
failed
) fi
}}}
))
}}}
{{{ )
(test-char ") (
set-counter fence-counter 1
do (
{{{ check one character
previous-text-character
if test-char ") (
add-counter fence-counter 1
) else (
if test-char "( (add-counter fence-counter -1) fi
) fi
}}}
) while and(not(counter-0 fence-counter),not(test-top))
{{{ not found ?
if test-top (
goto-line-counter matching-fence-y
goto-counter matching-fence-x
failed
) fi
}}}
))
}}}
esac
))
}}}