Permalink
Browse files

Make 'typeset' a synonym for 'declare' for now.

  • Loading branch information...
Andy Chu
Andy Chu committed Oct 18, 2017
1 parent b900561 commit 08622d445a440083da63468d59c86df5f3640441
Showing with 5 additions and 2 deletions.
  1. +2 −1 core/cmd_exec.py
  2. +1 −1 core/id_kind.py
  3. +1 −0 osh/lex.py
  4. +1 −0 osh/osh.asdl
View
@@ -672,7 +672,8 @@ def _Dispatch(self, node, fork_external):
if node.keyword == Id.Assign_Local:
lookup_mode = scope.LocalOnly
flags = ()
elif node.keyword == Id.Assign_Declare:
# typeset and declare are synonyms? I see typeset -a a=() the most.
elif node.keyword in (Id.Assign_Declare, Id.Assign_Typeset):
# declare is like local, except it can also be used outside functions?
lookup_mode = scope.LocalOnly
# TODO: Respect flags. -r and -x matter, but -a and -A might be
View
@@ -366,7 +366,7 @@ def _AddKinds(spec):
# "None" could either be a global variable or assignment to a local.
# NOTE: We're not parsing export here. Although it sets a global variable,
# and has the same syntax, too many scripts use it in a dynamic fashion.
spec.AddKind('Assign', ['Declare', 'Local', 'Readonly', 'None'])
spec.AddKind('Assign', ['Declare', 'Typeset', 'Local', 'Readonly', 'None'])
# Unlike bash, we parse control flow statically. They're not
# dynamically-resolved builtins.
View
@@ -187,6 +187,7 @@
# main compatibility with bash for the 'type' builtin.
_MORE_KEYWORDS = [
C('declare', Id.Assign_Declare),
C('typeset', Id.Assign_Typeset),
C('local', Id.Assign_Local),
C('readonly', Id.Assign_Readonly),
View
@@ -14,6 +14,7 @@
-- * select block
-- * &> redirect both stdout and stderr
-- * 1>&2- to close redirect
-- * case fallthrough ;& and ;;&
-- Represented but Not Parsed:
-- * LeftIndex -- LHS of assignment

0 comments on commit 08622d4

Please sign in to comment.