diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index 5c3de141..761288f0 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -63,7 +63,8 @@ module Linguist generated_jni_header? || composer_lock? || node_modules? || - vcr_cassette? + vcr_cassette? || + generated_by_zephir? end # Internal: Is the blob an XCode project file? @@ -237,6 +238,13 @@ module Linguist !!name.match(/composer.lock/) end + # Internal: Is the blob a generated by Zephir + # + # Returns true or false. + def generated_by_zephir? + !!name.match(/.\.zep\.(?:c|h|php)$/) + end + # Is the blob a VCR Cassette file? # # Returns true or false diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 1f3db02c..400b897e 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -741,10 +741,15 @@ ], "YAML": [ ".gemrc" + ], + "Zephir": [ + "exception.zep.c", + "exception.zep.h", + "exception.zep.php" ] }, - "tokens_total": 614434, - "languages_total": 812, + "tokens_total": 614493, + "languages_total": 815, "tokens": { "ABAP": { "*/**": 1, @@ -66810,27 +66815,27 @@ }, "Zephir": { "%": 10, - "{": 56, + "{": 58, "#define": 1, "MAX_FACTOR": 3, - "}": 50, - "namespace": 3, - "Test": 2, - ";": 86, - "#include": 1, + "}": 52, + "namespace": 4, + "Test": 4, + ";": 91, + "#include": 9, "static": 1, "long": 3, "fibonacci": 4, - "(": 55, + "(": 59, "n": 5, - ")": 53, + ")": 57, "if": 39, - "<": 1, - "return": 25, + "<": 2, + "return": 26, "else": 11, "-": 25, "+": 5, - "class": 2, + "class": 3, "Cblock": 1, "public": 22, "function": 22, @@ -66838,7 +66843,29 @@ "int": 3, "a": 6, "testCblock2": 1, - "Router": 1, + "#ifdef": 1, + "HAVE_CONFIG_H": 1, + "#endif": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "ZEPHIR_INIT_CLASS": 2, + "Test_Router_Exception": 2, + "ZEPHIR_REGISTER_CLASS_EX": 1, + "Router": 3, + "Exception": 4, + "test": 1, + "router_exception": 1, + "zend_exception_get_default": 1, + "TSRMLS_C": 1, + "NULL": 1, + "SUCCESS": 1, + "extern": 1, + "zend_class_entry": 1, + "*test_router_exception_ce": 1, + "php": 1, + "extends": 1, "Route": 1, "protected": 9, "_pattern": 3, @@ -66917,7 +66944,6 @@ "typeof": 2, "throw": 1, "new": 1, - "Exception": 1, "explode": 1, "switch": 1, "count": 1, @@ -67189,7 +67215,7 @@ "XSLT": 44, "Xtend": 399, "YAML": 77, - "Zephir": 1026, + "Zephir": 1085, "Zimpl": 123 }, "languages": { @@ -67380,8 +67406,8 @@ "XSLT": 1, "Xtend": 2, "YAML": 2, - "Zephir": 2, + "Zephir": 5, "Zimpl": 1 }, - "md5": "3e0901633ee5729c6dac371442522f33" + "md5": "c05a50dcc060bd36069504536d354c35" } \ No newline at end of file diff --git a/samples/Zephir/filenames/exception.zep.c b/samples/Zephir/filenames/exception.zep.c new file mode 100644 index 00000000..c1e0bc09 --- /dev/null +++ b/samples/Zephir/filenames/exception.zep.c @@ -0,0 +1,28 @@ + +#ifdef HAVE_CONFIG_H +#include "../../ext_config.h" +#endif + +#include +#include "../../php_ext.h" +#include "../../ext.h" + +#include +#include +#include + +#include "kernel/main.h" + + +/** + * Test\Router\Exception + * + * Exceptions generated by the router + */ +ZEPHIR_INIT_CLASS(Test_Router_Exception) { + + ZEPHIR_REGISTER_CLASS_EX(Test\\Router, Exception, test, router_exception, zend_exception_get_default(TSRMLS_C), NULL, 0); + + return SUCCESS; + +} diff --git a/samples/Zephir/filenames/exception.zep.h b/samples/Zephir/filenames/exception.zep.h new file mode 100644 index 00000000..49d56b9c --- /dev/null +++ b/samples/Zephir/filenames/exception.zep.h @@ -0,0 +1,4 @@ + +extern zend_class_entry *test_router_exception_ce; + +ZEPHIR_INIT_CLASS(Test_Router_Exception); diff --git a/samples/Zephir/filenames/exception.zep.php b/samples/Zephir/filenames/exception.zep.php new file mode 100644 index 00000000..f6087a8d --- /dev/null +++ b/samples/Zephir/filenames/exception.zep.php @@ -0,0 +1,8 @@ +