diff options
| author | Chong Yidong | 2009-11-28 21:09:00 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-11-28 21:09:00 +0000 |
| commit | fd1cefda5892e57f9d2c9dd264e24a9f878346d0 (patch) | |
| tree | 5a91f1289767735d85167c9e61217ca2dad244cf /doc | |
| parent | 26224fafa0c504defeff50909e887ea48b06353b (diff) | |
| download | emacs-fd1cefda5892e57f9d2c9dd264e24a9f878346d0.tar.gz emacs-fd1cefda5892e57f9d2c9dd264e24a9f878346d0.zip | |
* semantic.texi (Analyzer Internals): Rename from Analyzer.
* sem-user.texi (Semantic mode user commands): Fix key syntax.
Document semantic-complete-analyze-inline.
(Semanticdb search debugging commands): Minor clarification.
(Analyzer, Smart Completion, Smart Summary, Smart Jump)
(Analyzer Debug) New nodes, adapted from the upstream Semantic user
manual.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/misc/ChangeLog | 11 | ||||
| -rw-r--r-- | doc/misc/sem-user.texi | 385 | ||||
| -rw-r--r-- | doc/misc/semantic.texi | 12 |
3 files changed, 380 insertions, 28 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 261a0daeb8f..ee85ec2a2ec 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2009-11-28 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * semantic.texi (Analyzer Internals): Rename from Analyzer. | ||
| 4 | |||
| 5 | * sem-user.texi (Semantic mode user commands): Fix key syntax. | ||
| 6 | Document semantic-complete-analyze-inline. | ||
| 7 | (Semanticdb search debugging commands): Minor clarification. | ||
| 8 | (Analyzer, Smart Completion, Smart Summary, Smart Jump) | ||
| 9 | (Analyzer Debug) New nodes, adapted from the upstream Semantic user | ||
| 10 | manual. | ||
| 11 | |||
| 1 | 2009-11-28 Kevin Ryde <user42@zip.com.au> | 12 | 2009-11-28 Kevin Ryde <user42@zip.com.au> |
| 2 | 13 | ||
| 3 | * cl.texi (Porting Common Lisp): Update EIEIO dead ftp link to a | 14 | * cl.texi (Porting Common Lisp): Update EIEIO dead ftp link to a |
diff --git a/doc/misc/sem-user.texi b/doc/misc/sem-user.texi index dfca1a09295..582ffb9103b 100644 --- a/doc/misc/sem-user.texi +++ b/doc/misc/sem-user.texi | |||
| @@ -28,6 +28,7 @@ File,,,emacs,Emacs manual}. | |||
| 28 | * Semantic mode:: Global minor mode for @semantic{}. | 28 | * Semantic mode:: Global minor mode for @semantic{}. |
| 29 | * SemanticDB:: Caching parsed buffers between sessions. | 29 | * SemanticDB:: Caching parsed buffers between sessions. |
| 30 | * Idle Scheduler:: Performing @semantic{} operations when idle. | 30 | * Idle Scheduler:: Performing @semantic{} operations when idle. |
| 31 | * Analyzer:: Semantic tools for analyzing code. | ||
| 31 | @end menu | 32 | @end menu |
| 32 | 33 | ||
| 33 | @node Semantic mode | 34 | @node Semantic mode |
| @@ -107,64 +108,70 @@ Others act on the @dfn{current tag}, meaning the tag at (or around) | |||
| 107 | point. | 108 | point. |
| 108 | 109 | ||
| 109 | @table @kbd | 110 | @table @kbd |
| 110 | @item \C-c , j | 111 | @item C-c , j |
| 111 | Prompt for a tag defined in the current file, and move point to it | 112 | Prompt for a tag defined in the current file, and move point to it |
| 112 | (@code{semantic-complete-jump-local}). | 113 | (@code{semantic-complete-jump-local}). |
| 113 | 114 | ||
| 114 | @item \C-c , J | 115 | @item C-c , J |
| 115 | Prompt for a tag defined in any file that Emacs has parsed, and move | 116 | Prompt for a tag defined in any file that Emacs has parsed, and move |
| 116 | point to it (@code{semantic-complete-jump}). | 117 | point to it (@code{semantic-complete-jump}). |
| 117 | 118 | ||
| 118 | @item \C-c , l | 119 | @item C-c , l |
| 119 | Display a list of the possible completions of the current tag | 120 | Display a list of the possible completions of the current tag |
| 120 | (@code{semantic-analyze-possible-completions}). | 121 | (@code{semantic-analyze-possible-completions}). |
| 121 | 122 | ||
| 122 | @item \C-c , g | 123 | @item C-c , g |
| 123 | Prompt for a tag, and display a list of tags that call it | 124 | Prompt for a tag, and display a list of tags that call it |
| 124 | (@code{semantic-symref-symbol}). | 125 | (@code{semantic-symref-symbol}). |
| 125 | 126 | ||
| 126 | @item \C-c , G | 127 | @item C-c , G |
| 127 | Display a list of tags that call the current tag | 128 | Display a list of tags that call the current tag |
| 128 | (@code{semantic-symref}). | 129 | (@code{semantic-symref}). |
| 129 | 130 | ||
| 130 | @item \C-c , p | 131 | @item C-c , p |
| 131 | Move point to the previous tag (@code{senator-previous-tag}). | 132 | Move point to the previous tag (@code{senator-previous-tag}). |
| 132 | 133 | ||
| 133 | @item \C-c , n | 134 | @item C-c , n |
| 134 | Move point to the next tag (@code{senator-next-tag}). | 135 | Move point to the next tag (@code{senator-next-tag}). |
| 135 | 136 | ||
| 136 | @item \C-c , u | 137 | @item C-c , u |
| 137 | Move point ``up'' one reference (@code{senator-go-to-up-reference}). | 138 | Move point ``up'' one reference (@code{senator-go-to-up-reference}). |
| 138 | The meaning of ``up'' is language-dependent; in C++, for instance, | 139 | The meaning of ``up'' is language-dependent; in C++, for instance, |
| 139 | this means moving to the parent of the current tag. | 140 | this means moving to the parent of the current tag. |
| 140 | 141 | ||
| 141 | @item \C-c, @key{SPC} | 142 | @item C-c, @key{SPC} |
| 142 | (@code{semantic-complete-analyze-inline}) | 143 | Display a list of possible completions for the symbol at point |
| 144 | (@code{semantic-complete-analyze-inline}). This also activates a | ||
| 145 | special set of keybindings for choosing a completion: @key{RET} | ||
| 146 | accepts the current completion, @kbd{M-n} and @kbd{M-p} cycle through | ||
| 147 | possible completions, @key{TAB} completes as far as possible and then | ||
| 148 | cycles, and @kbd{C-g} or any other key aborts the completion. | ||
| 149 | @xref{Smart Completion}. | ||
| 143 | 150 | ||
| 144 | @item \C-c,\C-w | 151 | @item C-c , C-w |
| 145 | Kill the current tag (@code{senator-kill-tag}). This removes the text | 152 | Kill the current tag (@code{senator-kill-tag}). This removes the text |
| 146 | for that tag, placing it in the kill ring. You can retrieve the text | 153 | for that tag, placing it in the kill ring. You can retrieve the text |
| 147 | with @kbd{C-y}. This also places the tag in the @dfn{tag ring}, so | 154 | with @kbd{C-y}. This also places the tag in the @dfn{tag ring}, so |
| 148 | that you can yank it with @kbd{\C-c,\C-y}, below. | 155 | that you can yank it with @kbd{\C-c,\C-y}, below. |
| 149 | 156 | ||
| 150 | @item \C-c,\M-w | 157 | @item C-c , M-w |
| 151 | Copy the current tag into the kill ring as well as the tag ring | 158 | Copy the current tag into the kill ring as well as the tag ring |
| 152 | (@code{senator-copy-tag}). | 159 | (@code{senator-copy-tag}). |
| 153 | 160 | ||
| 154 | @item \C-c,\C-y | 161 | @item C-c , C-y |
| 155 | Yank a tag from the tag ring (@code{senator-yank-tag}). | 162 | Yank a tag from the tag ring (@code{senator-yank-tag}). |
| 156 | 163 | ||
| 157 | @item \C-c,r | 164 | @item C-c , r |
| 158 | Copy the current tag into a register | 165 | Copy the current tag into a register |
| 159 | (@code{senator-copy-tag-to-register}). With an optional argument, | 166 | (@code{senator-copy-tag-to-register}). With an optional argument, |
| 160 | kill it as well. This allows you to insert or jump to that tag with | 167 | kill it as well. This allows you to insert or jump to that tag with |
| 161 | the usual register commands. @xref{Registers,,,emacs,Emacs manual}. | 168 | the usual register commands. @xref{Registers,,,emacs,Emacs manual}. |
| 162 | 169 | ||
| 163 | @item ?\C-c , @kbd{up} | 170 | @item \C-c , @kbd{up} |
| 164 | Transpose the current tag with the previous one | 171 | Transpose the current tag with the previous one |
| 165 | (@code{senator-transpose-tags-up}). | 172 | (@code{senator-transpose-tags-up}). |
| 166 | 173 | ||
| 167 | @item ?\C-c ?, @kbd{down} | 174 | @item C-c , @kbd{down} |
| 168 | Transpose the current tag with the next one | 175 | Transpose the current tag with the next one |
| 169 | (@code{senator-transpose-tags-down}). | 176 | (@code{senator-transpose-tags-down}). |
| 170 | @end table | 177 | @end table |
| @@ -433,7 +440,6 @@ You can use @kbd{M-x semanticdb-dump-all-table-summary} to see the | |||
| 433 | list of databases that will be searched from a given buffer. You can | 440 | list of databases that will be searched from a given buffer. You can |
| 434 | follow up with @kbd{M-x semanticdb-find-test-translate-path} to then | 441 | follow up with @kbd{M-x semanticdb-find-test-translate-path} to then |
| 435 | make sure specific tables from the path are discovered correctly. | 442 | make sure specific tables from the path are discovered correctly. |
| 436 | |||
| 437 | Alternately, you can get a list of include files @semantic{} | 443 | Alternately, you can get a list of include files @semantic{} |
| 438 | encountered, but could not find on disk using @kbd{M-x | 444 | encountered, but could not find on disk using @kbd{M-x |
| 439 | semanticdb-find-adebug-lost-includes}. | 445 | semanticdb-find-adebug-lost-includes}. |
| @@ -443,10 +449,11 @@ semanticdb-find-adebug-lost-includes}. | |||
| 443 | Dump a list of all databases in Emacs memory. | 449 | Dump a list of all databases in Emacs memory. |
| 444 | @end deffn | 450 | @end deffn |
| 445 | 451 | ||
| 446 | @deffn Command semanticdb-find-test-translate-path &optional arg | ||
| 447 | @anchor{semanticdb-find-test-translate-path} | 452 | @anchor{semanticdb-find-test-translate-path} |
| 448 | Call and output results of @dfn{semanticdb-find-translate-path} | 453 | @deffn Command semanticdb-find-test-translate-path &optional arg |
| 449 | With @var{arg} non-@code{nil}, specify a @var{brutish} translation. | 454 | Call and output results of @dfn{semanticdb-find-translate-path}. In |
| 455 | the displayed buffer, you can type @key{SPC} to expand items. With | ||
| 456 | @var{arg} non-@code{nil}, specify a @var{brutish} translation. | ||
| 450 | @end deffn | 457 | @end deffn |
| 451 | 458 | ||
| 452 | @deffn Command semanticdb-find-adebug-lost-includes | 459 | @deffn Command semanticdb-find-adebug-lost-includes |
| @@ -681,8 +688,8 @@ Semantic Idle Completions mode is a minor mode for performing | |||
| 681 | displayed inline, with keybindings that allow you to cycle through | 688 | displayed inline, with keybindings that allow you to cycle through |
| 682 | different alternatives. | 689 | different alternatives. |
| 683 | 690 | ||
| 684 | @c @xref{Analyzer}, for information about code | 691 | Semantic Idle Completions mode performs completion based on the |
| 685 | @c completion. | 692 | Semantic Analyzer (@pxref{Analyzer}). |
| 686 | 693 | ||
| 687 | @anchor{global-semantic-idle-completions-mode} | 694 | @anchor{global-semantic-idle-completions-mode} |
| 688 | @anchor{semantic-idle-completions-mode} | 695 | @anchor{semantic-idle-completions-mode} |
| @@ -761,3 +768,337 @@ Display completions in a tooltip. | |||
| 761 | Display completions in a separate window. | 768 | Display completions in a separate window. |
| 762 | @end table | 769 | @end table |
| 763 | @end deffn | 770 | @end deffn |
| 771 | |||
| 772 | @node Analyzer | ||
| 773 | @section Analyzer | ||
| 774 | @cindex Analyzer | ||
| 775 | |||
| 776 | The Semantic Analyzer is a library for performing context analysis on | ||
| 777 | source code. It provides user commands for displaying, completing, | ||
| 778 | and navigating through source code. | ||
| 779 | |||
| 780 | @menu | ||
| 781 | * Smart Completion:: Performing code completion. | ||
| 782 | * Smart Summary:: Displaying help on a symbol. | ||
| 783 | * Smart Jump:: Jumping to the definition of a tag. | ||
| 784 | * Analyzer Debug:: Debugging problems with the analyzer. | ||
| 785 | @end menu | ||
| 786 | |||
| 787 | @node Smart Completion | ||
| 788 | @subsection Smart Completion | ||
| 789 | |||
| 790 | The Semantic Analyzer can be used to perform code completion in a | ||
| 791 | manner that takes the local context into account. | ||
| 792 | |||
| 793 | In addition to the user commands documented in this section, the | ||
| 794 | completions performed by Semantic Idle Completions mode also uses the | ||
| 795 | Semantic Analyzer. @xref{Idle Completions Mode}. | ||
| 796 | |||
| 797 | @deffn Command semantic-analyze-possible-completions context | ||
| 798 | This is the most basic command for Semantic Analyzer-based completion. | ||
| 799 | Called interactively, it displays in another window a list of the | ||
| 800 | possible completions for the symbol at point. | ||
| 801 | |||
| 802 | When called from a Lisp program, | ||
| 803 | @code{semantic-analyze-possible-completions} does not display a | ||
| 804 | completions list. The argument @var{context} should be either a | ||
| 805 | buffer position, or a context object. The return value is a list of | ||
| 806 | @semantic{} tag objects that complete the symbol for @var{context}, | ||
| 807 | based on the following criteria: | ||
| 808 | |||
| 809 | @itemize | ||
| 810 | @item Elements currently in scope. | ||
| 811 | @item Constants currently in scope. | ||
| 812 | @item Elements matching the context's @code{:prefix}. | ||
| 813 | @item Type of the completion matching the type of the context. | ||
| 814 | @end itemize | ||
| 815 | |||
| 816 | Most of the other commands documented in this section call | ||
| 817 | @code{semantic-analyze-possible-completions} internally. | ||
| 818 | @end deffn | ||
| 819 | |||
| 820 | @anchor{semantic-complete-analyze-inline} | ||
| 821 | @deffn Command semantic-complete-analyze-inline | ||
| 822 | This command is bound to @kbd{C-c , @key{SPC}} when Semantic mode is | ||
| 823 | enabled (@pxref{Semantic mode user commands}). It displays a list of | ||
| 824 | possible completions for the symbol at point, and activates a special | ||
| 825 | set of keybindings for choosing a completion. | ||
| 826 | |||
| 827 | You can type @key{RET} to accept the current completion, @kbd{M-n} and | ||
| 828 | @kbd{M-p} to cycle through the possible completions, @key{TAB} to | ||
| 829 | complete as far as possible and then cycle through completions, and | ||
| 830 | either @kbd{C-g} or any other key to abort the completion. | ||
| 831 | |||
| 832 | This command is similar to the completion performed by Semantic Idle | ||
| 833 | Completions mode. The main difference is that it is called | ||
| 834 | explicitly, whereas Semantic Idle Completions mode completes during | ||
| 835 | idle time (@pxref{Idle Completions Mode}). | ||
| 836 | @end deffn | ||
| 837 | |||
| 838 | @anchor{semantic-complete-inline-analyzer-displayor-class} | ||
| 839 | @deffn Option semantic-complete-inline-analyzer-idle-displayor-class | ||
| 840 | The value of this variable determines how | ||
| 841 | @code{semantic-complete-analyze-inline} shows its completions. | ||
| 842 | Possible values include: | ||
| 843 | |||
| 844 | @table @code | ||
| 845 | @item semantic-displayor-traditional | ||
| 846 | Display completions in a separate window. This is the default value. | ||
| 847 | |||
| 848 | @item semantic-displayor-ghost | ||
| 849 | Display completions ``inline'' with the buffer text, similar to the | ||
| 850 | default behavior of Semantic Idle Completions mode (@pxref{Idle | ||
| 851 | Completions Mode}). | ||
| 852 | |||
| 853 | @item semantic-displayor-tooltip | ||
| 854 | Display completions in a tooltip. | ||
| 855 | @end table | ||
| 856 | @end deffn | ||
| 857 | |||
| 858 | In addition to @code{semantic-complete-analyze-inline}, you can use | ||
| 859 | the simpler command @code{semantic-ia-complete-symbol point}. This | ||
| 860 | behaves like the usual @kbd{M-@key{TAB}} (@code{complete-symbol}) | ||
| 861 | command (@pxref{Symbol Completion,,,emacs,Emacs manual}), except it | ||
| 862 | uses Semantic Analyzer. | ||
| 863 | |||
| 864 | @anchor{semantic-ia-complete-symbol} | ||
| 865 | @deffn Command semantic-ia-complete-symbol point | ||
| 866 | Complete the current symbol at @var{point}. | ||
| 867 | @end deffn | ||
| 868 | |||
| 869 | @node Smart Summary | ||
| 870 | @subsection Smart Summary | ||
| 871 | |||
| 872 | You can use the commands in this section to find information about the | ||
| 873 | code at point: | ||
| 874 | |||
| 875 | @anchor{semantic-ia-show-summary} | ||
| 876 | @deffn Command semantic-ia-show-summary pos | ||
| 877 | Display a summary for the symbol at @var{pos}. Called interactively, | ||
| 878 | @var{pos} defaults to point. | ||
| 879 | @end deffn | ||
| 880 | |||
| 881 | @anchor{semantic-ia-show-doc} | ||
| 882 | @deffn Command semantic-ia-show-doc pos | ||
| 883 | Display the code-level documentation for the symbol at @var{pos}. | ||
| 884 | Called interactively, @var{pos} defaults to point. | ||
| 885 | @end deffn | ||
| 886 | |||
| 887 | @anchor{semantic-ia-describe-class} | ||
| 888 | @deffn Command semantic-ia-describe-class typename | ||
| 889 | Prompt for the name of a data type, @var{typename}, and display its | ||
| 890 | components. For instance, if the type in question is a class, this | ||
| 891 | displays the methods and member variables. | ||
| 892 | @end deffn | ||
| 893 | |||
| 894 | You can also use Semantic Idle Summary mode to show information about | ||
| 895 | the current symbol in the echo area during idle time. @xref{Idle | ||
| 896 | Summary Mode}. | ||
| 897 | |||
| 898 | @node Smart Jump | ||
| 899 | @subsection Smart Jump | ||
| 900 | |||
| 901 | The Semantic Analyzer can be used to jump directly to the definition | ||
| 902 | for a code symbol. Because it is based on code analysis, its behavior | ||
| 903 | is often more accurate than than the @code{find-tag} command | ||
| 904 | (@pxref{Tags,,,emacs,Emacs manual}). | ||
| 905 | |||
| 906 | @anchor{semantic-ia-fast-jump} | ||
| 907 | @deffn Command semantic-ia-fast-jump pos | ||
| 908 | Jump to the definition for the symbol at @var{pos}. Called | ||
| 909 | interactively, @var{pos} defaults to point. | ||
| 910 | @end deffn | ||
| 911 | |||
| 912 | @anchor{semantic-ia-fast-mouse-jump} | ||
| 913 | @defun semantic-ia-fast-mouse-jump event | ||
| 914 | Jump to the definition for the symbol at the position of the mouse | ||
| 915 | event @var{event}. This command is meant to be bound to a mouse | ||
| 916 | command, like this: | ||
| 917 | |||
| 918 | @example | ||
| 919 | (global-set-key '[(S-mouse-1)] semantic-ia-fast-mouse-jump) | ||
| 920 | @end example | ||
| 921 | @end defun | ||
| 922 | |||
| 923 | You can also use @kbd{C-c , j} (@code{semantic-complete-jump-local}) | ||
| 924 | and @kbd{C-c , J} (@code{semantic-complete-jump}) to navigate tags. | ||
| 925 | @xref{Semantic mode user commands}. Those commands do not make use of | ||
| 926 | the Semantic Analyzer. | ||
| 927 | |||
| 928 | @node Analyzer Debug | ||
| 929 | @subsection Debugging the Semantic Analyzer | ||
| 930 | |||
| 931 | In the event that the Semantic Analyzer does not analyze your code | ||
| 932 | properly, you can take steps to identify and solve the problem. This | ||
| 933 | section was written with C/C++ in mind, but should be relevant for any | ||
| 934 | typed language. | ||
| 935 | |||
| 936 | @subsubsection Step 1: Check the context | ||
| 937 | |||
| 938 | The first thing to do is check the current context. You can do this | ||
| 939 | with @kbd{M-x semantic-analyze-current-context}. | ||
| 940 | |||
| 941 | @deffn Command semantic-analyze-current-context pos | ||
| 942 | Analyze the context at @var{pos}. This function is used by most of | ||
| 943 | the other Semantic Analyzer commands to obtain the context of the code | ||
| 944 | at a given buffer position. The return value is an EIEIO object | ||
| 945 | describing the context at @var{pos} (@pxref{Top,,,eieio,EIEIO | ||
| 946 | manual}). | ||
| 947 | |||
| 948 | When called interactively, this displays a @samp{*Semantic Context | ||
| 949 | Analysis*} buffer in a separate window. This buffer contains a | ||
| 950 | summary of the context at point. | ||
| 951 | @end deffn | ||
| 952 | |||
| 953 | The Prefix section of the @samp{*Semantic Context Analysis*} buffer | ||
| 954 | lists the tags based on the text at point. If it shows only a simple | ||
| 955 | string, the Semantic was unable to identify what the data type was. | ||
| 956 | |||
| 957 | The first item in the list of the prefix is the first lookup failure | ||
| 958 | in the chain, and that is the item to focus debugging effort on. For | ||
| 959 | example: | ||
| 960 | |||
| 961 | @example | ||
| 962 | Context Type: #<semantic-analyze-context context> | ||
| 963 | Bounds: (182 . 185) | ||
| 964 | Prefix: Foo* bar | ||
| 965 | int bbb (const char* y) | ||
| 966 | Prefix Types: class Foo @{@} | ||
| 967 | -------- | ||
| 968 | -> Local Vars: int argc | ||
| 969 | char** argv | ||
| 970 | @end example | ||
| 971 | |||
| 972 | In this example you can see that the prefix has two fully found tags. | ||
| 973 | In the following example, the symbol ``bbb'' is incomplete, and could | ||
| 974 | not be found: | ||
| 975 | |||
| 976 | @example | ||
| 977 | Context Type: #<semantic-analyze-context context> | ||
| 978 | Bounds: (182 . 184) | ||
| 979 | Prefix: Foo* bar | ||
| 980 | "bb" | ||
| 981 | Prefix Classes: 'function | ||
| 982 | 'variable | ||
| 983 | Prefix Types: class Foo @{@} | ||
| 984 | -------- | ||
| 985 | -> Local Vars: int argc | ||
| 986 | char** argv | ||
| 987 | @end example | ||
| 988 | |||
| 989 | @subsubsection Step 2 : Check your include path | ||
| 990 | |||
| 991 | Once you know what symbol can't be found, the next thing to check is | ||
| 992 | your include path. Is the header or include file that has the | ||
| 993 | definitions you need actually in the list of headers @semantic{} is | ||
| 994 | searching through? To get a basic list, you can use @kbd{M-x | ||
| 995 | semanticdb-find-test-translate-path}. @xref{Semanticdb search | ||
| 996 | debugging commands}. | ||
| 997 | |||
| 998 | For C++, check to make sure that your project level include files are | ||
| 999 | in quotes, and not angle brackets. Items in angle brackets are system | ||
| 1000 | includes. | ||
| 1001 | |||
| 1002 | If items should be loaded but aren't, you may need to update the | ||
| 1003 | search throttle. @xref{Search Throttle}. If you see some tables that | ||
| 1004 | have 0 tags in them, then you you may have an incorrectly set | ||
| 1005 | throttle. For example, | ||
| 1006 | |||
| 1007 | @example | ||
| 1008 | *#<semanticdb-table main.cpp (4 tags DIRTY)> | ||
| 1009 | *#<semanticdb-table foo.hh (0 tags DIRTY)> | ||
| 1010 | @end example | ||
| 1011 | |||
| 1012 | Here, @semantic{} found @file{foo.hh}, but there are 0 tags. This may | ||
| 1013 | be because the throttle was set to not read in and parse files that | ||
| 1014 | Emacs has not yet loaded in. To fix this case, visit the file, and | ||
| 1015 | let @semantic{} parse and save the tags table. | ||
| 1016 | |||
| 1017 | @subsubsection Step 3: Check the local scope | ||
| 1018 | |||
| 1019 | If your data type is somehow abbreviated based on scope, such as from | ||
| 1020 | a @code{using} statement, you should make sure that the symbol you | ||
| 1021 | want is in the local scope. Examine the scope with @kbd{M-x | ||
| 1022 | semantic-calculate-scope}. The scope structure is displayed in ADEBUG | ||
| 1023 | mode, so use @kbd{SPC} to expand different elements and looking for | ||
| 1024 | your symbol. | ||
| 1025 | |||
| 1026 | If your symbol should be in the scope, but you cannot find it, then | ||
| 1027 | you may have found a language support bug in the local-variable | ||
| 1028 | parser, or using statement parser. | ||
| 1029 | |||
| 1030 | Calling @kbd{M-x bovinte} should force a reset on the scope in case | ||
| 1031 | there is merely some bad state. | ||
| 1032 | |||
| 1033 | @example | ||
| 1034 | ] Name: Cache | ||
| 1035 | ] Class: #'semantic-scope-cache | ||
| 1036 | ] :table #<semanticdb-table testsubclass.cpp (13 tags DIRTY)> | ||
| 1037 | ] tag createMoose : class moose | ||
| 1038 | ] scopetypes 'nil | ||
| 1039 | ] parents #<TAG LIST: 1 entries> | ||
| 1040 | ] scope #<TAG LIST: 22 entries> | ||
| 1041 | ] fullscope #<TAG LIST: 23 entries> | ||
| 1042 | ] localvar #<TAG LIST: 6 entries> | ||
| 1043 | @end example | ||
| 1044 | |||
| 1045 | In the above sample output, the @code{tag} slot specifies where within | ||
| 1046 | you source this scope is relevant. @code{Parents} should contain any | ||
| 1047 | in scope parents, such as the class a method belongs to. | ||
| 1048 | @code{Localvar} should contain your local variables. @code{Scope} | ||
| 1049 | should contain datatypes in scope due to a @code{using} statement or | ||
| 1050 | the like. | ||
| 1051 | |||
| 1052 | @subsubsection Step 4: Check the typecache | ||
| 1053 | |||
| 1054 | For complex typed languages like C++, @semantic{} creates a typecache, | ||
| 1055 | or an optimized search table with all the various data types in it. | ||
| 1056 | Elements in the typecache do not obey local scope. It only contains | ||
| 1057 | fully qualified names. You can examine the typecache with | ||
| 1058 | @kbd{M-x semanticdb-typecache-dump}. | ||
| 1059 | |||
| 1060 | If your data types are not in the typecache, there may be some parsing | ||
| 1061 | error or other bug. Calling @kbd{M-x bovinte} should force a reset on | ||
| 1062 | the typecache in case there is merely some bad state. | ||
| 1063 | |||
| 1064 | @example | ||
| 1065 | ]#<semanticdb-typecache /home/zappo/cedet/semantic/tests/testsubclass.cpp> | ||
| 1066 | ] Name: /home/zappo/cedet/semantic/tests/testsubclass.cpp | ||
| 1067 | ] Class: #'semanticdb-typecache | ||
| 1068 | ] filestream 'nil | ||
| 1069 | ] includestream #<TAG LIST: 84 entries> | ||
| 1070 | ] stream 'nil | ||
| 1071 | ] dependants 'nil | ||
| 1072 | @end example | ||
| 1073 | |||
| 1074 | In the above example, the output of @kbd{M-x semanticdb-typecache-dump} | ||
| 1075 | was expanded one level. The @code{filestream} slot should contain | ||
| 1076 | datatypes in the current file. The @code{includestream} should | ||
| 1077 | contain all the datatypes in all included header files. | ||
| 1078 | |||
| 1079 | The @code{dependants} slot will specify other files that depend on | ||
| 1080 | this one. | ||
| 1081 | |||
| 1082 | @section Step 5: Check the parser | ||
| 1083 | |||
| 1084 | Go to the location where your unfound tag should be. You can call | ||
| 1085 | @kbd{M-x bovinate}, and see a dump of the raw tag structure. To see a | ||
| 1086 | navigable tree, use @kbd{M-x semantic-adebug-bovinate} instead. You | ||
| 1087 | can then look to make sure your tag has been properly parsed. | ||
| 1088 | |||
| 1089 | If it has not, then you may have found a parser bug. To get a feel | ||
| 1090 | how @semantic{} treats your file, type @kbd{M-x | ||
| 1091 | global-semantic-show-unmatched-syntax-mode}. This causes any syntax | ||
| 1092 | it cannot parse to be underlined in red. | ||
| 1093 | |||
| 1094 | If your type is not parsable, it could be for a couple of reasons: | ||
| 1095 | |||
| 1096 | @enumerate | ||
| 1097 | @item | ||
| 1098 | If there is a MACRO keyword used in the definition of the type, you | ||
| 1099 | may need to update the @code{semantic-lex-c-preprocessor-symbol-map} | ||
| 1100 | to account for it. | ||
| 1101 | |||
| 1102 | @item | ||
| 1103 | Or perhaps the parser needs to be fixed. | ||
| 1104 | @end enumerate | ||
diff --git a/doc/misc/semantic.texi b/doc/misc/semantic.texi index 064f1a6e3ae..b880f1a20fc 100644 --- a/doc/misc/semantic.texi +++ b/doc/misc/semantic.texi | |||
| @@ -240,8 +240,8 @@ more about how @semantic{} works. | |||
| 240 | @menu | 240 | @menu |
| 241 | * Parser code :: Code used for the parsers | 241 | * Parser code :: Code used for the parsers |
| 242 | * Tag handling :: Code used for manipulating tags | 242 | * Tag handling :: Code used for manipulating tags |
| 243 | * Semanticdb internals :: Code used in the semantic database | 243 | * Semanticdb Internals :: Code used in the semantic database |
| 244 | * Analyzer :: Code used in the code analyzer | 244 | * Analyzer Internals :: Code used in the code analyzer |
| 245 | * Tools :: Code used in user tools | 245 | * Tools :: Code used in user tools |
| 246 | * Tests :: Code used for testing | 246 | * Tests :: Code used for testing |
| 247 | @end menu | 247 | @end menu |
| @@ -349,8 +349,8 @@ Capture documentation comments from near a tag. | |||
| 349 | 349 | ||
| 350 | @end table | 350 | @end table |
| 351 | 351 | ||
| 352 | @node Semanticdb internals | 352 | @node Semanticdb Internals |
| 353 | @section Semanticdb internals | 353 | @section Semanticdb Internals |
| 354 | 354 | ||
| 355 | @acronym{Semanticdb} complexity is certainly an issue. It is a rather | 355 | @acronym{Semanticdb} complexity is certainly an issue. It is a rather |
| 356 | hairy problem to try and solve. | 356 | hairy problem to try and solve. |
| @@ -400,8 +400,8 @@ need to be flushed. References are in the form of include files. | |||
| 400 | 400 | ||
| 401 | @end table | 401 | @end table |
| 402 | 402 | ||
| 403 | @node Analyzer | 403 | @node Analyzer Internals |
| 404 | @section Analyzer | 404 | @section Analyzer Internals |
| 405 | 405 | ||
| 406 | The @semantic{} analyzer is a complex engine which has been broken | 406 | The @semantic{} analyzer is a complex engine which has been broken |
| 407 | down across several modules. When the @semantic{} analyzer fails, | 407 | down across several modules. When the @semantic{} analyzer fails, |