about summary refs log tree commit diff
path: root/docs/tool/Modules/NaturalDocs/Languages/Advanced
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tool/Modules/NaturalDocs/Languages/Advanced')
-rw-r--r--docs/tool/Modules/NaturalDocs/Languages/Advanced/Scope.pm95
-rw-r--r--docs/tool/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm70
2 files changed, 165 insertions, 0 deletions
diff --git a/docs/tool/Modules/NaturalDocs/Languages/Advanced/Scope.pm b/docs/tool/Modules/NaturalDocs/Languages/Advanced/Scope.pm
new file mode 100644
index 00000000..e1e50a95
--- /dev/null
+++ b/docs/tool/Modules/NaturalDocs/Languages/Advanced/Scope.pm
@@ -0,0 +1,95 @@
+###############################################################################
+#
+#   Class: NaturalDocs::Languages::Advanced::Scope
+#
+###############################################################################
+#
+#   A class used to store a scope level.
+#
+###############################################################################
+
+# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
+# Natural Docs is licensed under the GPL
+
+use strict;
+use integer;
+
+package NaturalDocs::Languages::Advanced::Scope;
+
+#
+#   Constants: Implementation
+#
+#   The object is implemented as a blessed arrayref.  The constants below are used as indexes.
+#
+#   CLOSING_SYMBOL - The closing symbol character of the scope.
+#   PACKAGE - The package <SymbolString> of the scope.
+#   USING - An arrayref of <SymbolStrings> for using statements, or undef if none.
+#
+use NaturalDocs::DefineMembers 'CLOSING_SYMBOL', 'PACKAGE', 'USING';
+# Dependency: New() depends on the order of these constants as well as that there is no inherited members.
+
+
+#
+#   Function: New
+#
+#   Creates and returns a new object.
+#
+#   Parameters:
+#
+#       closingSymbol - The closing symbol character of the scope.
+#       package - The package <SymbolString> of the scope.
+#       using - An arrayref of using <SymbolStrings>, or undef if none.  The contents of the array will be duplicated.
+#
+#       If package is set to undef, it is assumed that it inherits the value of the previous scope on the stack.
+#
+sub New #(closingSymbol, package, using)
+    {
+    # Dependency: This depends on the order of the parameters matching the constants, and that there are no inherited
+    # members.
+    my $package = shift;
+
+    my $object = [ @_ ];
+    bless $object, $package;
+
+    if (defined $object->[USING])
+        {  $object->[USING] = [ @{$object->[USING]} ];  };
+
+    return $object;
+    };
+
+
+# Function: ClosingSymbol
+# Returns the closing symbol character of the scope.
+sub ClosingSymbol
+    {  return $_[0]->[CLOSING_SYMBOL];  };
+
+# Function: Package
+# Returns the package <SymbolString> of the scope, or undef if none.
+sub Package
+    {  return $_[0]->[PACKAGE];  };
+
+# Function: SetPackage
+# Sets the package <SymbolString> of the scope.
+sub SetPackage #(package)
+    {  $_[0]->[PACKAGE] = $_[1];  };
+
+# Function: Using
+# Returns an arrayref of <SymbolStrings> for using statements, or undef if none
+sub Using
+    {  return $_[0]->[USING];  };
+
+# Function: AddUsing
+# Adds a <SymbolString> to the <Using()> array.
+sub AddUsing #(using)
+    {
+    my ($self, $using) = @_;
+
+    if (!defined $self->[USING])
+        {  $self->[USING] = [ ];  };
+
+    push @{$self->[USING]}, $using;
+    };
+
+
+
+1;
diff --git a/docs/tool/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm b/docs/tool/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm
new file mode 100644
index 00000000..24de5503
--- /dev/null
+++ b/docs/tool/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm
@@ -0,0 +1,70 @@
+###############################################################################
+#
+#   Class: NaturalDocs::Languages::Advanced::ScopeChange
+#
+###############################################################################
+#
+#   A class used to store a scope change.
+#
+###############################################################################
+
+# This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
+# Natural Docs is licensed under the GPL
+
+use strict;
+use integer;
+
+package NaturalDocs::Languages::Advanced::ScopeChange;
+
+#
+#   Constants: Implementation
+#
+#   The object is implemented as a blessed arrayref.  The constants below are used as indexes.
+#
+#   SCOPE - The new scope <SymbolString>.
+#   LINE_NUMBER - The line number of the change.
+#
+use NaturalDocs::DefineMembers 'SCOPE', 'LINE_NUMBER';
+# Dependency: New() depends on the order of these constants as well as that there is no inherited members.
+
+
+#
+#   Function: New
+#
+#   Creates and returns a new object.
+#
+#   Parameters:
+#
+#       scope - The <SymbolString> the scope was changed to.
+#       lineNumber - What line it occurred on.
+#
+sub New #(scope, lineNumber)
+    {
+    # Dependency: This depends on the order of the parameters matching the constants, and that there are no inherited
+    # members.
+    my $self = shift;
+
+    my $object = [ @_ ];
+    bless $object, $self;
+
+    return $object;
+    };
+
+
+# Function: Scope
+# Returns the <SymbolString> the scope was changed to.
+sub Scope
+    {  return $_[0]->[SCOPE];  };
+
+# Function: SetScope
+# Replaces the <SymbolString> the scope was changed to.
+sub SetScope #(scope)
+    {  $_[0]->[SCOPE] = $_[1];  };
+
+# Function: LineNumber
+# Returns the line number of the change.
+sub LineNumber
+    {  return $_[0]->[LINE_NUMBER];  };
+
+
+1;