• re2c是一个软件工具,该工具将允许你写的速度非常快并且非常灵活的扫描仪。 不同于其他任何这样的工具,re2c的重点是产生高效代码,用于经常表达的匹配。

    re2c是一种预处理就产生基于C识别器由经常表达方式。 输入到re2c由C/C++源交织的意见的形式/*!re2c...*/其中包含有扫描仪规范。

    在输出这些评论意见的替代码,当执行时,会发现一个新的输入令牌,然后执行一些用户提供的令牌特定的代码。

    因此,这允许在一个更广泛的使用,比任何传统的语法分析程序提供。 最后但并非最不重要的re2c产生警告代码等同于手写代码在规模、速度和质量。

    re2c不提供默认的行动:产生的代码假设的投入将包括一个序列的标记。 这通常可以处理通过添加一项规则,如一个意想不到的字在上面的例子。

    用户必须安排一个前哨令牌出现在末尾的输入(并提供一个规则为匹配):re2c没有提供一个表达。 如果源自一个null byte终止串,一项规则匹配的空字就足够了。

    如果源自一个文件,然后你可以垫输入有newline(或一些其他的性格,不能出现在另一个令牌);在认识到这样的性格检查,看看它是哨兵,并采取相应的行动。

    你也可以使用YYFILL(n)结束的扫描仪的情况下,没有足够的人物供这是什么然后电子检测结束的数据/文件。

    re2c不提供启动条件:使用一个单独的扫描仪规范为各个起始条件(如在上面的例子)。

  • re2c है एक सॉफ्टवेयर उपकरण है कि आप की अनुमति देगा लिखने के लिए बहुत तेजी से और बहुत लचीला स्कैनर । किसी दूसरे के विपरीत इस तरह के उपकरण, re2c पैदा करने पर केंद्रित है उच्च कुशल कोड के लिए नियमित अभिव्यक्ति मिलान.

    re2c एक पूर्वप्रक्रमक उत्पन्न करता है कि सी-आधारित recognizers से नियमित अभिव्यक्ति. इनपुट करने के लिए re2c के होते हैं C/C++ स्रोत interleaved के साथ टिप्पणी के रूप में /*!re2c ... */ होते हैं जो स्कैनर विनिर्देशों ।

    उत्पादन में इन टिप्पणियों के साथ प्रतिस्थापित कर रहे हैं कि कोड, जब मार डाला, मिल जाएगा अगले इनपुट टोकन और फिर निष्पादित कुछ उपयोगकर्ता की आपूर्ति टोकन-विशिष्ट कोड है ।

    एक परिणाम के रूप में यह अनुमति देता है एक बहुत व्यापक रेंज के उपयोग से किसी भी पारंपरिक lexer प्रदान करता है. और पिछले नहीं बल्कि कम से कम re2c चेतावनी उत्पन्न करता है नि: शुल्क कोड के बराबर होता है कि हाथ से लिखा कोड के मामले में आकार, गति और गुणवत्ता.

    re2c प्रदान नहीं करता है एक डिफ़ॉल्ट कार्रवाई: उत्पन्न कोड मानता है कि इनपुट से मिलकर करेंगे के एक दृश्य टोकन. आमतौर पर इस के साथ निपटा जा सकता जोड़ने के द्वारा, एक नियम के रूप में इस तरह के लिए एक अप्रत्याशित पात्रों ऊपर के उदाहरण में.

    उपयोगकर्ता की व्यवस्था करना चाहिए के लिए एक प्रहरी टोकन पर प्रदर्शित करने के लिए इनपुट के अंत (और प्रदान के लिए एक नियम यह मेल): re2c प्रदान नहीं करता है एक अभिव्यक्ति है । यदि स्रोत है से एक अशक्त बाइट समाप्त स्ट्रिंग, एक नियम मिलान एक अशक्त चरित्र पर्याप्त होगा ।

    यदि स्रोत से एक फ़ाइल है, तो आप सकता है पैड इनपुट के साथ एक नई (या कुछ अन्य चरित्र नहीं कर सकते हैं कि दिखाई देते हैं के भीतर एक और टोकन); पहचानने पर इस तरह के एक चरित्र की जाँच करें देखने के लिए अगर यह है, प्रहरी और उसके अनुसार कार्य.

    और आप भी उपयोग कर सकते हैं YYFILL(एन) खत्म करने के लिए स्कैनर के मामले में पर्याप्त नहीं वर्ण उपलब्ध हैं जो और कुछ नहीं है तो ई का पता लगाने के अंत डेटा/फ़ाइल ।

    re2c प्रदान नहीं करता है, शुरू की स्थिति: उपयोग एक अलग स्कैनर के लिए विशिष्टता प्रत्येक शुरू करने की स्थिति (के रूप में ऊपर के उदाहरण में सचित्र).

  • re2c is a software tool that will allow you to write very fast and very flexible scanners. Unlike any other such tool, re2c focuses on generating high efficient code for regular expression matching.

    re2c is a preprocessor that generates C-based recognizers from regular expressions. The input to re2c consists of C/C++ source interleaved with comments of the form /*!re2c ... */ which contain scanner specifications.

    In the output these comments are replaced with code that, when executed, will find the next input token and then execute some user-supplied token-specific code.

    As a result this allows a much broader range of use than any traditional lexer offers. And Last but not least re2c generates warning free code that is equal to hand-written code in terms of size, speed and quality.

    re2c does not provide a default action: the generated code assumes that the input will consist of a sequence of tokens. Typically this can be dealt with by adding a rule such as the one for unexpected characters in the example above.

    The user must arrange for a sentinel token to appear at the end of input (and provide a rule for matching it): re2c does not provide an expression. If the source is from a null-byte terminated string, a rule matching a null character will suffice.

    If the source is from a file then you could pad the input with a newline (or some other character that cannot appear within another token); upon recognizing such a character check to see if it is the sentinel and act accordingly.

    And you can also use YYFILL(n) to end the scanner in case not enough characters are available which is nothing else then e detection of end of data/file.

    re2c does not provide start conditions: use a separate scanner specification for each start condition (as illustrated in the above example).