diff --git a/Modules/HeaderDoc/BlockParse.pm b/Modules/HeaderDoc/BlockParse.pm index 5241dbf..789a21a 100644 --- a/Modules/HeaderDoc/BlockParse.pm +++ b/Modules/HeaderDoc/BlockParse.pm @@ -3,7 +3,7 @@ # Module name: BlockParse # Synopsis: Block parser code # -# Last Updated: $Date: 2014/02/26 11:14:02 $ +# Last Updated: $Date: 2014/03/05 14:20:14 $ # # Copyright (c) 1999-2004 Apple Computer, Inc. All rights reserved. # @@ -122,7 +122,7 @@ use File::Basename qw(basename); # In the git repository, contains the number of seconds since # January 1, 1970. # */ -$HeaderDoc::BlockParse::VERSION = '$Revision: 1393442042 $'; +$HeaderDoc::BlockParse::VERSION = '$Revision: 1394058014 $'; ################ Portability ################################### my $isMacOS; @@ -6334,6 +6334,7 @@ sub blockParseReturnState my $nameObjDumpDebug = 0; # $forcedebug = 1; + if ($forcedebug) { $parserState->dbprint(); } if ($forcedebug) { $treeTop->dbprint(); } $forcedebug = $forcedebug || $HeaderDoc::fileDebug; diff --git a/Modules/HeaderDoc/HeaderElement.pm b/Modules/HeaderDoc/HeaderElement.pm index 6f237fe..6b71381 100644 --- a/Modules/HeaderDoc/HeaderElement.pm +++ b/Modules/HeaderDoc/HeaderElement.pm @@ -3,7 +3,7 @@ # Class name: HeaderElement # Synopsis: Root class for Function, Typedef, Constant, etc. -- used by HeaderDoc. # -# Last Updated: $Date: 2014/03/01 09:00:38 $ +# Last Updated: $Date: 2014/03/05 14:20:14 $ # # Copyright (c) 1999-2004 Apple Computer, Inc. All rights reserved. # @@ -384,7 +384,7 @@ if ($^O =~ /MacOS/io) { # In the git repository, contains the number of seconds since # January 1, 1970. # */ -$HeaderDoc::HeaderElement::VERSION = '$Revision: 1393693238 $'; +$HeaderDoc::HeaderElement::VERSION = '$Revision: 1394058014 $'; # /*! # @abstract @@ -8568,6 +8568,25 @@ sub declaredIn return ""; } + # print STDERR "DI: $self APIO: $apio\n"; + + if ($apio->{AS_FUNC_SELF}) { + my $func_apio_ref = $apio->{AS_FUNC_SELF}; + if (!$func_apio_ref) { + die("Bad AS_FUNC_SELF for $apio (".$apio->name().")\n"); + } + my $func_apio = ${$func_apio_ref}; + bless($func_apio, "HeaderDoc::HeaderElement"); + bless($func_apio, $func_apio->class()); + + # print STDERR "CLASS IN FUNC\n"; + my $name = $func_apio->name(); + my $apiref = $func_apio->apiuid(); + my $jumpTarget = $apiref; + + return "$name"; + } + if ($self->isAPIOwner()) { if ($class =~ /HeaderDoc::Header/) { # warn $self->name.": Header\n"; @@ -9489,6 +9508,7 @@ sub cloneAppleScriptFunctionContents my $class_self = HeaderDoc::CPPClass->new(); $self->{AS_CLASS_SELF} = \$class_self; + $class_self->{AS_FUNC_SELF} = \$self; my $orig_ptref = $self->{PARSETREE}; bless($orig_ptref, "HeaderDoc::ParseTree"); diff --git a/Modules/HeaderDoc/ParseTree.pm b/Modules/HeaderDoc/ParseTree.pm index 4c5fd7b..e0405e4 100644 --- a/Modules/HeaderDoc/ParseTree.pm +++ b/Modules/HeaderDoc/ParseTree.pm @@ -2,7 +2,7 @@ # # Class name: ParseTree # Synopsis: Used by headerdoc2html to hold parse trees -# Last Updated: $Date: 2014/02/25 15:48:22 $ +# Last Updated: $Date: 2014/03/05 14:20:14 $ # # Copyright (c) 1999-2004 Apple Computer, Inc. All rights reserved. # @@ -177,7 +177,7 @@ use Carp qw(cluck); # In the git repository, contains the number of seconds since # January 1, 1970. # */ -$HeaderDoc::ParseTree::VERSION = '$Revision: 1393372102 $'; +$HeaderDoc::ParseTree::VERSION = '$Revision: 1394058014 $'; ################ General Constants ################################### my $debugging = 0; @@ -1093,7 +1093,7 @@ sub processEmbeddedTags } else { print STDERR "calling processEmbeddedTagsRec for $apio (".$apio->name().") for parse tree $self.\n" if ($localDebug); $self->processEmbeddedTagsRec($xmlmode, $eoDeclaration, \%parseTokens, $case_sensitive, $keywordhashref, $lastDeclaration, $curDeclaration, $pendingHDcomment, - $apio, $apiolist, $sodec, $lastnode, $enable_javadoc_comments); + $apio, $apiolist, $sodec, $lastnode, $enable_javadoc_comments, undef); } print STDERR "PETDONE\n" if ($localDebug); @@ -1655,6 +1655,7 @@ sub processEmbeddedTagsRec my $sodec = shift; my $lastTreeNode = shift; my $enable_javadoc_comments = shift; + my $ASterminator = shift; my %parseTokens = %{$parseTokensRef}; @@ -1680,7 +1681,7 @@ print STDERR "PETREC\n" if ($localDebug); print STDERR "PENDING COMMENT: $pendingHDcomment\n" if ($localDebug); print STDERR "LAST DECLARATION: $lastDeclaration\n" if ($localDebug); - if (!$self) { return ($eoDeclaration, $pendingHDcomment, $continue); } + if (!$self) { return ($eoDeclaration, $pendingHDcomment, $continue, $ASterminator); } my $apioclass = ref($apio) || $apio; if ($apioclass =~ /HeaderDoc::PDefine/) { @@ -1695,6 +1696,14 @@ print STDERR "LAST DECLARATION: $lastDeclaration\n" if ($localDebug); } } + if ($apio->lang() eq "applescript") { + if (!$ASterminator) { + if ($self->token eq "(") { + $ASterminator = $self; + } + } + } + if ($self == $lastTreeNode) { print STDERR "CONTINUE -> 0\n" if ($localDebug); $continue = 0; @@ -1936,13 +1945,15 @@ print STDERR "LAST DECLARATION: $lastDeclaration\n" if ($localDebug); if ($firstchild && !$skipchildren) { my $nestallowed = commentsNestedIn($token, $parseTokens{soc}, $parseTokens{eoc}, $parseTokens{ilc}, $parseTokens{ilc_b}, $parseTokens{lbrace}, $case_sensitive); if ($nestallowed == 1) { - my $newcontinue; - ($eoDeclaration, $pendingHDcomment, $newcontinue) = $firstchild->processEmbeddedTagsRec($xmlmode, $eoDeclaration, $parseTokensRef, $case_sensitive, $keywordhashref, "", "", "", $apio, $apiolist, $sodec, $lastTreeNode, $enable_javadoc_comments); + my $newcontinue; my $newASterminator; + ($eoDeclaration, $pendingHDcomment, $newcontinue, $newASterminator) = $firstchild->processEmbeddedTagsRec($xmlmode, $eoDeclaration, $parseTokensRef, $case_sensitive, $keywordhashref, "", "", "", $apio, $apiolist, $sodec, $lastTreeNode, $enable_javadoc_comments, $ASterminator); if ($continue) { $continue = $newcontinue; } + if (!$ASterminator) { $ASterminator = $newASterminator; } } else { - my $newcontinue; - ($eoDeclaration, $pendingHDcomment, $newcontinue) = $firstchild->processEmbeddedTagsRec($xmlmode, $eoDeclaration, $parseTokensRef, $case_sensitive, $keywordhashref, "", "$curDeclaration", "", $apio, $apiolist, $sodec, $lastTreeNode, $enable_javadoc_comments); + my $newcontinue; my $newASterminator; + ($eoDeclaration, $pendingHDcomment, $newcontinue, $newASterminator) = $firstchild->processEmbeddedTagsRec($xmlmode, $eoDeclaration, $parseTokensRef, $case_sensitive, $keywordhashref, "", "$curDeclaration", "", $apio, $apiolist, $sodec, $lastTreeNode, $enable_javadoc_comments, $ASterminator); if ($continue) { $continue = $newcontinue; } + if (!$ASterminator) { $ASterminator = $newASterminator; } } $curDeclaration .= textTree($firstchild); } elsif ($firstchild && !$skipchildren) { @@ -2019,11 +2030,15 @@ print STDERR "LAST DECLARATION: $lastDeclaration\n" if ($localDebug); } } # $sodec = $oldsodec; + if ($ASterminator == $self) { + $continue = 0; + } + if ($next && $continue) { - ($eoDeclaration, $pendingHDcomment, $continue) = $next->processEmbeddedTagsRec($xmlmode, $eoDeclaration, $parseTokensRef, $case_sensitive, $keywordhashref, $lastDeclaration, $curDeclaration, $pendingHDcomment, $apio, $apiolist, $sodec, $lastTreeNode, $enable_javadoc_comments); + ($eoDeclaration, $pendingHDcomment, $continue) = $next->processEmbeddedTagsRec($xmlmode, $eoDeclaration, $parseTokensRef, $case_sensitive, $keywordhashref, $lastDeclaration, $curDeclaration, $pendingHDcomment, $apio, $apiolist, $sodec, $lastTreeNode, $enable_javadoc_comments, $ASterminator); } - return ($eoDeclaration, $pendingHDcomment, $continue); + return ($eoDeclaration, $pendingHDcomment, $continue, $ASterminator); } # THIS CODE USED TO PROCESS COMMENTS WHENEVER IT IS TIME. diff --git a/Modules/HeaderDoc/ParserState.pm b/Modules/HeaderDoc/ParserState.pm index 3090e04..4470e89 100644 --- a/Modules/HeaderDoc/ParserState.pm +++ b/Modules/HeaderDoc/ParserState.pm @@ -2,7 +2,7 @@ # # Class name: ParserState # Synopsis: Used by headerDoc2HTML.pl to hold parser state -# Last Updated: $Date: 2014/02/24 16:34:49 $ +# Last Updated: $Date: 2014/03/05 14:20:15 $ # # Copyright (c) 1999-2004 Apple Computer, Inc. All rights reserved. # @@ -1231,7 +1231,7 @@ use Carp qw(cluck); # In the git repository, contains the number of seconds since # January 1, 1970. # */ -$HeaderDoc::ParserState::VERSION = '$Revision: 1393288489 $'; +$HeaderDoc::ParserState::VERSION = '$Revision: 1394058015 $'; ################ General Constants ################################### my $debugging = 0; @@ -1620,7 +1620,7 @@ sub rollback my %clonehash = %{$clone}; if ($localDebug) { - print STDERR "BEGIN PARSER STATE:\n"; + print STDERR "BEGIN PARSER STATE ($self):\n"; foreach my $key (keys(%clonehash)) { if ($self->{$key} ne $clone->{$key}) { print STDERR "$key: ".$self->{$key}." != ".$clone->{$key}."\n"; @@ -1651,7 +1651,7 @@ sub rollbackSet my $clone = HeaderDoc::ParserState->new(); my %selfhash = %{$self}; - # print STDERR "BEGIN PARSER STATE:\n"; + # print STDERR "BEGIN PARSER STATE ($self):\n"; foreach my $key (keys(%selfhash)) { # print STDERR "$key => $self->{$key}\n"; $clone->{$key} = $self->{$key}; @@ -1672,7 +1672,7 @@ sub print my $self = shift; my %selfhash = %{$self}; - print STDERR "BEGIN PARSER STATE:\n"; + print STDERR "BEGIN PARSER STATE ($self):\n"; foreach my $key (keys(%selfhash)) { print STDERR "$key => $self->{$key}\n"; } diff --git a/testsuite/parser_tests/AppleScript_script_in_function_1.test b/testsuite/parser_tests/AppleScript_script_in_function_1.test index 6f949e7..1a738c7 100644 Binary files a/testsuite/parser_tests/AppleScript_script_in_function_1.test and b/testsuite/parser_tests/AppleScript_script_in_function_1.test differ