亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? extending.html

?? Exuberant Ctags is a multilanguage reimplementation of the much-underused ctags(1) program and is i
?? HTML
字號:
<!-- $Id: EXTENDING.html,v 1.9 2002/09/04 01:17:32 darren Exp $ --><html><head><title>Exuberant Ctags: Adding support for a new language</title></head><body><h1>How to Add Support for a New Language to Exuberant Ctags</h1><p><b>Exuberant Ctags</b> has been designed to make it very easy to add your owncustom language parser. As an exercise, let us assume that I want to addsupport for my new language, <em>Swine</em>, the successor to Perl (i.e. Perlbefore Swine &lt;wince&gt;). This language consists of simple definitions oflabels in the form "<code>def my_label</code>". Let us now examine the variousways to do this.</p><h2>Operational background</h2><p>As ctags considers each file name, it tries to determine the language of thefile by applying the following three tests in order: if the file extension hasbeen mapped to a language, if the file name matches a shell pattern mapped toa language, and finally if the file is executable and its first line specifiesan interpreter using the Unix-style "#!" specification (if supported on theplatform). If a language was identified, the file is opened and then theappropriate language parser is called to operate on the currently open file.The parser parses through the file and whenever it finds some interestingtoken, calls a function to define a tag entry.</p><h2>Creating a user-defined language</h2><p>The quickest and easiest way to do this is by defining a new language usingthe program options. In order to have Swine support available every time Istart ctags, I will place the following lines into the file<code>$HOME/.ctags</code>, which is read in every time ctags starts:<code><pre>  --langdef=swine  --langmap=swine:.swn  --regex-swine=/^def[ \t]*([a-zA-Z0-9_]+)/\1/d,definition/</pre></code>The first line defines the new language, the second maps a file extension toit, and the third defines a regular expression to identify a languagedefinition and generate a tag file entry for it.</p><h2>Integrating a new language parser</h2><p>Now suppose that I want to truly integrate compiled-in support for Swine intoctags. First, I create a new module, <code>swine.c</code>, and add oneexternally visible function to it, <code>extern parserDefinition*SwineParser(void)</code>, and add its name to the table in<code>parsers.h</code>. The job of this parser definition function is tocreate an instance of the <code>parserDefinition</code> structure (using<code>parserNew()</code>) and populate it with information defining how filesof this language are recognized, what kinds of tags it can locate, and thefunction used to invoke the parser on the currently open file.</p><p>The structure <code>parserDefinition</code> allows assignment of the followingfields:<code><pre>  const char *name;               /* name of language */  kindOption *kinds;              /* tag kinds handled by parser */  unsigned int kindCount;         /* size of `kinds' list */  const char *const *extensions;  /* list of default extensions */  const char *const *patterns;    /* list of default file name patterns */  parserInitialize initialize;    /* initialization routine, if needed */  simpleParser parser;            /* simple parser (common case) */  rescanParser parser2;           /* rescanning parser (unusual case) */  boolean regex;                  /* is this a regex parser? */</pre></code></p><p>The <code>name</code> field must be set to a non-empty string. Also, unless<code>regex</code> is set true (see below), either <code>parser</code> or<code>parser2</code> must set to point to a parsing routine which willgenerate the tag entries. All other fields are optional.<p>Now all that is left is to implement the parser. In order to do its job, theparser should read the file stream using using one of the two I/O interfaces:either the character-oriented <code>fileGetc()</code>, or the line-oriented<code>fileReadLine()</code>. When using <code>fileGetc()</code>, the parsercan put back a character using <code>fileUngetc()</code>. How our Swine parseractually parses the contents of the file is entirely up to the writer of theparser--it can be as crude or elegant as desired. You will note a variety ofexamples from the most complex (c.c) to the simplest (make.c).</p><p>When the Swine parser identifies an interesting token for which it wants toadd a tag to the tag file, it should create a <code>tagEntryInfo</code>structure and initialize it by calling <code>initTagEntry()</code>, whichinitializes defaults and fills information about the current line number andthe file position of the beginning of the line. After filling in informationdefining the current entry (and possibly overriding the file position or otherdefaults), the parser passes this structure to <code>makeTagEntry()</code>.</p><p>Instead of writing a character-oriented parser, it may be possible to specifyregular expressions which define the tags. In this case, instead of defining aparsing function, <code>SwineParser()</code>, sets <code>regex</code> to true,and points <code>initialize</code> to a function which calls<code>addTagRegex()</code> to install the regular expressions which define itstags. The regular expressions thus installed are compared against each line of the input file and generate a specified tag when matched. It is usuallymuch easier to write a regex-based parser, although they can be slower (oneparser example was 4 times slower). Whether the speed difference matters toyou depends upon how much code you have to parse. It is probably a goodstrategy to implement a regex-based parser first, and if it is too slow foryou, then invest the time and effort to write a character-based parser.</p><p>A regex-based parser is inherently line-oriented (i.e. the entire tag must berecognizable from looking at a single line) and context-insensitive (i.e thegeneration of the tag is entirely based upon when the regular expressionmatches a single line). However, a regex-based callback mechanism is alsoavailable, installed via the function <code>addCallbackRegex()</code>. Thisallows a specified function to be invoked whenever a specific regularexpression is matched. This allows a character-oriented parser to operatebased upon context of what happened on a previous line (e.g. the start or endof a multi-line comment). Note that regex callbacks are called just before thefirst character of that line can is read via either <code>fileGetc()</code> orusing <code>fileGetc()</code>. The effect of this is that before either ofthese routines return, a callback routine may be invoked because the linematched a regex callback. A callback function to be installed is defined bythese types:<code><pre>  typedef void (*regexCallback) (const char *line, const regexMatch *matches, unsigned int count);  typedef struct {      size_t start;   /* character index in line where match starts */      size_t length;  /* length of match */  } regexMatch;</pre></code></p><p>The callback function is passed the line matching the regular expression andan array of <code>count</code> structures defining the subexpression matchesof the regular expression, starting from \0 (the entire line).</p><p>Lastly, be sure to add your the name of the file containing your parser (e.g.swine.c) to the macro <code>SOURCES</code> in the file <code>source.mak</code>and an entry for the object file to the macro <code>OBJECTS</code> in the samefile, so that your new module will be compiled into the program.</p><p>This is all there is to it. All other details are specific to the parser andhow it wants to do its job. There are some support functions which can takecare of some commonly needed parsing tasks, such as keyword table lookups (seekeyword.c), which you can make use of if desired (examples of its use can befound in c.c, eiffel.c, and fortran.c). Almost everything is already taken careof automatically for you by the infrastructure.  Writing the actual parsingalgorithm is the hardest part, but is not constrained by any need to conformto anything in ctags other than that mentioned above.</p><p>There are several different approaches used in the parsers inside <b>ExuberantCtags</b> and you can browse through these as examples of how to go aboutcreating your own.</p><h2>Examples</h2><p>Below you will find several example parsers demonstrating most of thefacilities available. These include three alternative implementationsof a Swine parser, which generate tags for lines beginning with"<CODE>def</CODE>" followed by some name.</p><code><pre>/*************************************************************************** * swine.c * Character-based parser for Swine definitions **************************************************************************//* INCLUDE FILES */#include "general.h"    /* always include first */#include &lt;string.h&gt;     /* to declare strxxx() functions */#include &lt;ctype.h&gt;      /* to define isxxx() macros */#include "parse.h"      /* always include */#include "read.h"       /* to define file fileReadLine() *//* DATA DEFINITIONS */typedef enum eSwineKinds {    K_DEFINE} swineKind;static kindOption SwineKinds [] = {    { TRUE, 'd', "definition", "pig definition" }};/* FUNCTION DEFINITIONS */static void findSwineTags (void){    vString *name = vStringNew ();    const unsigned char *line;    while ((line = fileReadLine ()) != NULL)    {        /* Look for a line beginning with "def" followed by name */        if (strncmp ((const char*) line, "def", (size_t) 3) == 0  &amp;&amp;            isspace ((int) line [3]))        {            const unsigned char *cp = line + 4;            while (isspace ((int) *cp))                ++cp;            while (isalnum ((int) *cp)  ||  *cp == '_')            {                vStringPut (name, (int) *cp);                ++cp;            }            vStringTerminate (name);            makeSimpleTag (name, SwineKinds, K_DEFINE);            vStringClear (name);        }    }    vStringDelete (name);}/* Create parser definition stucture */extern parserDefinition* SwineParser (void){    static const char *const extensions [] = { "swn", NULL };    parserDefinition* def = parserNew ("Swine");    def-&gt;kinds      = SwineKinds;    def-&gt;kindCount  = KIND_COUNT (SwineKinds);    def-&gt;extensions = extensions;    def-&gt;parser     = findSwineTags;    return def;}</pre></code><p><pre><code>/*************************************************************************** * swine.c * Regex-based parser for Swine **************************************************************************//* INCLUDE FILES */#include "general.h"    /* always include first */#include "parse.h"      /* always include *//* FUNCTION DEFINITIONS */static void installSwineRegex (const langType language){    addTagRegex (language, "^def[ \t]*([a-zA-Z0-9_]+)", "\\1", "d,definition", NULL);}/* Create parser definition stucture */extern parserDefinition* SwineParser (void){    static const char *const extensions [] = { "swn", NULL };    parserDefinition* def = parserNew ("Swine");    parserDefinition* const def = parserNew ("Makefile");    def-&gt;patterns   = patterns;    def-&gt;extensions = extensions;    def-&gt;initialize = installMakefileRegex;    def-&gt;regex      = TRUE;    return def;}</code></pre><p><pre>/*************************************************************************** * swine.c * Regex callback-based parser for Swine definitions **************************************************************************//* INCLUDE FILES */#include "general.h"    /* always include first */#include "parse.h"      /* always include */#include "read.h"       /* to define file fileReadLine() *//* DATA DEFINITIONS */typedef enum eSwineKinds {    K_DEFINE} swineKind;static kindOption SwineKinds [] = {    { TRUE, 'd', "definition", "pig definition" }};/* FUNCTION DEFINITIONS */static void definition (const char *const line, const regexMatch *const matches,                       const unsigned int count){    if (count &gt; 1)    /* should always be true per regex */    {        vString *const name = vStringNew ();        vStringNCopyS (name, line + matches [1].start, matches [1].length);        makeSimpleTag (name, SwineKinds, K_DEFINE);    }}static void findSwineTags (void){    while (fileReadLine () != NULL)        ;  /* don't need to do anything here since callback is sufficient */}static void installSwine (const langType language){    addCallbackRegex (language, "^def[ \t]+([a-zA-Z0-9_]+)", NULL, definition);}/* Create parser definition stucture */extern parserDefinition* SwineParser (void){    static const char *const extensions [] = { "swn", NULL };    parserDefinition* def = parserNew ("Swine");    def-&gt;kinds      = SwineKinds;    def-&gt;kindCount  = KIND_COUNT (SwineKinds);    def-&gt;extensions = extensions;    def-&gt;parser     = findSwineTags;    def-&gt;initialize = installSwine;    return def;}</pre><p><pre>/*************************************************************************** * make.c * Regex-based parser for makefile macros **************************************************************************//* INCLUDE FILES */#include "general.h"    /* always include first */#include "parse.h"      /* always include *//* FUNCTION DEFINITIONS */static void installMakefileRegex (const langType language){    addTagRegex (language, "(^|[ \t])([A-Z0-9_]+)[ \t]*:?=", "\\2", "m,macro", "i");}/* Create parser definition stucture */extern parserDefinition* MakefileParser (void){    static const char *const patterns [] = { "[Mm]akefile", NULL };    static const char *const extensions [] = { "mak", NULL };    parserDefinition* const def = parserNew ("Makefile");    def-&gt;patterns   = patterns;    def-&gt;extensions = extensions;    def-&gt;initialize = installMakefileRegex;    def-&gt;regex      = TRUE;    return def;}</pre></body></html>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜av在线| 国产精品国产a级| 最新久久zyz资源站| 丝袜美腿亚洲综合| av高清不卡在线| 2020国产精品| 日韩av一区二区三区| 色一区在线观看| 中文字幕精品在线不卡| 国产乱码精品1区2区3区| 欧美精品精品一区| 夜夜嗨av一区二区三区四季av| 国内精品视频666| 538prom精品视频线放| 亚洲成人在线免费| 一本色道久久加勒比精品| 国产精品情趣视频| 国产成人啪免费观看软件| 精品国产一区二区三区不卡| 免费精品视频最新在线| 欧美精品一卡两卡| 午夜电影久久久| 欧美精品在线一区二区| 午夜精品一区二区三区免费视频 | 激情欧美日韩一区二区| 欧美日韩国产首页在线观看| 一区二区三区在线观看国产| av不卡一区二区三区| 国产精品丝袜久久久久久app| 国产精一区二区三区| 久久午夜羞羞影院免费观看| 黄色日韩网站视频| 国产日韩v精品一区二区| 国产综合色精品一区二区三区| 精品日韩欧美在线| 国产精品主播直播| 中文字幕精品一区二区精品绿巨人 | 国产亚洲欧美色| 国产麻豆91精品| 国产欧美一区二区三区沐欲| 国产东北露脸精品视频| 中文字幕不卡在线观看| 99国产精品久久久久久久久久| 亚洲精品ww久久久久久p站| 欧美吻胸吃奶大尺度电影| 丝袜美腿高跟呻吟高潮一区| 精品久久免费看| 国产盗摄一区二区| 亚洲欧美在线高清| 欧美日韩国产一级片| 久久狠狠亚洲综合| 国产精品第一页第二页第三页| 99国产麻豆精品| 亚洲.国产.中文慕字在线| 欧美xxxx老人做受| eeuss国产一区二区三区| 亚洲在线视频免费观看| 日韩一区二区视频在线观看| 国产老肥熟一区二区三区| 亚洲精品视频一区| 日韩一区二区三区在线观看| 成人小视频免费在线观看| 亚洲成人一区在线| 久久精品人人做| 欧美日韩久久久| 国产传媒一区在线| 亚洲一区欧美一区| 久久一区二区视频| 欧美影院精品一区| 国产成人在线视频免费播放| 亚洲一区二区av电影| ww亚洲ww在线观看国产| 欧美日韩在线直播| 福利电影一区二区三区| 五月婷婷激情综合| 国产精品成人一区二区艾草| 日韩免费成人网| 日本电影欧美片| 国产成人aaa| 美女视频黄a大片欧美| 中文字幕日韩av资源站| 精品成人一区二区三区四区| 欧美系列亚洲系列| 波波电影院一区二区三区| 激情久久五月天| 青青草成人在线观看| 亚洲一二三区不卡| 亚洲日本一区二区三区| 欧美精品一区二区三区四区| 欧美手机在线视频| 色婷婷av一区二区三区软件| 国产成人精品亚洲日本在线桃色| 日韩成人一区二区三区在线观看| 亚洲精品视频在线观看网站| 中文字幕久久午夜不卡| 久久亚洲影视婷婷| 精品国产乱码久久久久久影片| 欧美午夜精品久久久| 色婷婷综合久久久久中文| av在线一区二区| thepron国产精品| 国产一区二区三区视频在线播放| 日本强好片久久久久久aaa| 性做久久久久久免费观看欧美| 伊人婷婷欧美激情| 亚洲国产综合91精品麻豆| 亚洲欧美日韩系列| 亚洲日本中文字幕区| 中文字幕免费一区| 国产精品欧美一级免费| 欧美韩日一区二区三区| 国产精品蜜臀av| 中文字幕亚洲区| 亚洲精品免费播放| 亚洲午夜激情av| 日本亚洲视频在线| 久久精品国产秦先生| 国产乱妇无码大片在线观看| 国产精品亚洲专一区二区三区| 国产高清不卡一区二区| 99视频热这里只有精品免费| 99热99精品| 欧美在线你懂得| 8x福利精品第一导航| 日韩欧美一区二区久久婷婷| 欧美电视剧免费观看| 久久精品一区二区三区不卡牛牛| 国产亚洲一二三区| 亚洲视频网在线直播| 亚洲一二三四区不卡| 日本欧美一区二区三区乱码| 成人动漫一区二区三区| 91美女片黄在线观看| 欧美性感一类影片在线播放| 日韩欧美一区中文| 欧美高清在线精品一区| |精品福利一区二区三区| 丝袜亚洲精品中文字幕一区| 九九视频精品免费| 97久久久精品综合88久久| 欧美视频在线一区二区三区 | 亚洲三级视频在线观看| 亚洲不卡av一区二区三区| 激情深爱一区二区| 97se狠狠狠综合亚洲狠狠| 欧美日韩在线精品一区二区三区激情| 日韩精品在线网站| 亚洲欧美综合在线精品| 日韩在线卡一卡二| 北岛玲一区二区三区四区| 欧美日韩1区2区| 亚洲欧美一区二区在线观看| 日韩精品电影在线| 成+人+亚洲+综合天堂| 欧美一级片在线| 1000精品久久久久久久久| 奇米四色…亚洲| 色猫猫国产区一区二在线视频| 日韩美女视频一区二区在线观看| 中文字幕一区二区三区不卡在线| 免费成人在线视频观看| 99久久精品情趣| 久久久久国色av免费看影院| 亚洲成人动漫在线观看| 成人午夜在线播放| 日韩欧美综合一区| 亚洲国产精品一区二区www在线| 国产精品一区二区91| 欧美一区二区三区四区久久| 亚洲码国产岛国毛片在线| 狠狠色丁香久久婷婷综合_中 | 久久久久久免费网| 日韩成人伦理电影在线观看| 91视频www| 国产精品久久久久久久午夜片| 麻豆精品一区二区三区| 精品1区2区3区| 亚洲一区二区三区四区在线免费观看| 国产成人精品免费| 国产视频视频一区| 韩国女主播成人在线观看| 欧美蜜桃一区二区三区| 一区二区三区视频在线看| 91一区一区三区| 国产精品久久久久aaaa樱花 | 一区二区三区在线观看视频| 成人中文字幕合集| 中文字幕欧美激情一区| 国产麻豆视频精品| 久久综合中文字幕| 国内精品嫩模私拍在线| 精品电影一区二区三区| 久久国产三级精品| 欧美电影免费提供在线观看| 日韩电影在线一区二区| 666欧美在线视频| 日韩影视精彩在线| 91麻豆精品91久久久久久清纯| 亚洲愉拍自拍另类高清精品| 色综合天天综合|