summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-20 15:35:07 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-20 15:35:07 (EST)
commit897bd7b6ae7514896dae3253e854db5edc0b8009 (patch)
tree86a8797195edcb96249e80faf5242274f9ecdd01
parentc55bf702cb737865884a10993896acfb0c69f09d (diff)
downloadeggshell-897bd7b6ae7514896dae3253e854db5edc0b8009.zip
eggshell-897bd7b6ae7514896dae3253e854db5edc0b8009.tar.gz
eggshell-897bd7b6ae7514896dae3253e854db5edc0b8009.tar.bz2
s/pgetc/lgetc/
It reads input characters for the lexer, not the parser.
-rw-r--r--parsing/lexer.sh94
1 files changed, 47 insertions, 47 deletions
diff --git a/parsing/lexer.sh b/parsing/lexer.sh
index 292da43..3f6f52f 100644
--- a/parsing/lexer.sh
+++ b/parsing/lexer.sh
@@ -53,7 +53,7 @@ synerr()
# Input reading
#
-pgetc()
+lgetc()
{
c="$(dd bs=1 count=1 2>/dev/null; printf '.')"
c="${c%.}"
@@ -69,25 +69,25 @@ next()
dbg "parsing char '$c' at lineno $lineno"
case "${c}" in
'')
- pgetc
+ lgetc
tok=T_EOF
return
;;
"${LF}")
- pgetc
+ lgetc
lineno=$((${lineno} + 1))
tok=T_NEWLINE
return
;;
' '|"${HT}")
- pgetc
+ lgetc
continue
;;
\\)
- pgetc
+ lgetc
case "${c}" in "${LF}")
lineno=$((${lineno} + 1))
- pgetc
+ lgetc
continue
;;
esac
@@ -95,20 +95,20 @@ next()
return
;;
'#')
- pgetc
+ lgetc
while :; do
case "${c}" in "${LF}"|'')
break
;;
esac
- pgetc
+ lgetc
done
continue
;;
'&')
- pgetc
+ lgetc
case "${c}" in '&')
- pgetc
+ lgetc
tok=T_AND_IF
return
;;
@@ -117,9 +117,9 @@ next()
return
;;
'|')
- pgetc
+ lgetc
case "${c}" in '|')
- pgetc
+ lgetc
tok=T_OR_IF
return
;;
@@ -128,9 +128,9 @@ next()
return
;;
';')
- pgetc
+ lgetc
case "${c}" in ';')
- pgetc
+ lgetc
tok=T_DSEMI
return
;;
@@ -140,12 +140,12 @@ next()
return
;;
'(')
- pgetc
+ lgetc
tok=T_LPAREN
return
;;
')')
- pgetc
+ lgetc
tok=T_RPAREN
return
;;
@@ -158,7 +158,7 @@ next()
return
;;
esac
- pgetc
+ lgetc
done
}
@@ -166,41 +166,41 @@ next_io()
{
case "${c}" in
'<')
- pgetc
+ lgetc
case "${c}" in
'<')
- pgetc
+ lgetc
case "${c}" in '-')
- pgetc
+ lgetc
tok=T_DLESSDASH
;;
esac
tok=T_DLESS
;;
'&')
- pgetc
+ lgetc
tok=T_LESSAND
;;
'>')
- pgetc
+ lgetc
tok=T_LESSGREAT
;;
esac
tok=T_LESS
;;
'>')
- pgetc
+ lgetc
case "${c}" in
'>')
- pgetc
+ lgetc
tok=T_DGREAT
;;
'&')
- pgetc
+ lgetc
tok=T_GREATAND
;;
'|')
- pgetc
+ lgetc
tok=T_CLOBBER
;;
esac
@@ -267,7 +267,7 @@ scan_word()
word="${word}${c}"
;;
'$')
- pgetc
+ lgetc
if ! res=$(scan_wordexp); then
exit 1
fi
@@ -281,7 +281,7 @@ scan_word()
lineno=$((${lineno} + ${lineno_offset}))
word="${word}${wordexp}"
# scan_wordexp() leaves behind an unused
- # character, so we should skip the pgetc() call
+ # character, so we should skip the lgetc() call
# below.
continue
;;
@@ -293,7 +293,7 @@ scan_word()
\')
word="${word}${c}"
while :; do
- pgetc
+ lgetc
word="${word}${c}"
case "${c}" in \')
break
@@ -319,7 +319,7 @@ scan_word()
word="${word}${c}"
;;
esac
- pgetc
+ lgetc
done
printf "%d${RS}%c${RS}%s" ${lines} "${c}" "${word}"
@@ -341,10 +341,10 @@ scan_wordexp()
'{')
# Parameter expansion brace
mod=true
- pgetc
+ lgetc
case "${c}" in
'#')
- pgetc
+ lgetc
case "${c}" in
[@*#?$!A-Za-z0-9_-])
# String length
@@ -386,35 +386,35 @@ scan_wordexp()
':')
mod=true
wordexp="${wordexp}${c}"
- pgetc
+ lgetc
case "${c}" in '-'|'='|'?'|'+')
wordexp="${wordexp}${c}"
- pgetc
+ lgetc
;;
esac
;;
'-'|'='|'?'|'+')
mod=true
wordexp="${wordexp}${c}"
- pgetc
+ lgetc
;;
'%')
mod=true
wordexp="${wordexp}${c}"
- pgetc
+ lgetc
case "${c}" in '%')
wordexp="${wordexp}${c}"
- pgetc
+ lgetc
;;
esac
;;
'#')
mod=true
wordexp="${wordexp}${c}"
- pgetc
+ lgetc
case "${c}" in '#')
wordexp="${wordexp}${c}"
- pgetc
+ lgetc
;;
esac
;;
@@ -438,7 +438,7 @@ scan_wordexp()
case "${c}" in
'}')
wordexp="${wordexp}${c}"
- pgetc
+ lgetc
;;
*)
synerr 'Missing "}"'
@@ -447,7 +447,7 @@ scan_wordexp()
;;
'(')
# Arithmetic expansion or command substitution
- pgetc
+ lgetc
case "${c}" in
'(')
# Arithmetic expansion
@@ -497,32 +497,32 @@ scan_param()
[@*#?$!0-])
# Special parameter
param="${c}"
- pgetc
+ lgetc
;;
[1-9])
# Positional parameter
param="${param}${c}"
- pgetc
+ lgetc
while :; do
case "${c}" in [!0-9])
break
;;
esac
param="${param}${c}"
- pgetc
+ lgetc
done
;;
[A-Za-z_])
# Parameter name
param="${param}${c}"
- pgetc
+ lgetc
while :; do
case "${c}" in [!A-Za-z0-9_])
break
;;
esac
param="${param}${c}"
- pgetc
+ lgetc
done
;;
*)
@@ -695,7 +695,7 @@ run_lexer()
tokens=''
# Read the first character and recognize the first token.
- pgetc
+ lgetc
next
# If this returns (does not exit), there are no errors.