diff --git a/Gopkg.lock b/Gopkg.lock index b8e6437..4d639b3 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -379,8 +379,8 @@ "uast/viewer", "uast/yaml" ] - revision = "82ab50025f39a4d522a9124f69bd9cf5220ed6b9" - version = "v2.16.0" + revision = "a7cb6c25d2968d3f254149b7b878c4f5270dd1b6" + version = "v2.16.4" [[projects]] name = "gopkg.in/src-d/go-errors.v1" diff --git a/fixtures/unicode.cpp b/fixtures/unicode.cpp new file mode 100644 index 0000000..9f35456 --- /dev/null +++ b/fixtures/unicode.cpp @@ -0,0 +1 @@ +auto a = "𝓏"; \ No newline at end of file diff --git a/fixtures/unicode.cpp.native b/fixtures/unicode.cpp.native new file mode 100644 index 0000000..9f91246 --- /dev/null +++ b/fixtures/unicode.cpp.native @@ -0,0 +1,77 @@ +{ + IASTClass: "CPPASTTranslationUnit", + LocOffsetEnd: 14, + LocOffsetStart: 0, + 'Prop_BuiltinMacroDefinitions': [], + 'Prop_Declarations': [ + { + IASTClass: "CPPASTSimpleDeclaration", + LocOffsetEnd: 14, + LocOffsetStart: 0, + 'Prop_DeclSpecifier': { + IASTClass: "CPPASTSimpleDeclSpecifier", + IsComplex: false, + IsConst: false, + IsConstExpr: false, + IsExplicit: false, + IsFriend: false, + IsImaginary: false, + IsInline: false, + IsLong: false, + IsLongLong: false, + IsRestrict: false, + IsShort: false, + IsSigned: false, + IsThreadLocal: false, + IsUnsigned: false, + IsVirtual: false, + IsVolatile: false, + LocOffsetEnd: 4, + LocOffsetStart: 0, + StorageClass: "unspecified", + Type: "auto", + }, + 'Prop_Declarators': [ + { + DeclaresParameterPack: false, + IASTClass: "CPPASTDeclarator", + LocOffsetEnd: 13, + LocOffsetStart: 5, + 'Prop_Initializer': { + IASTClass: "CPPASTEqualsInitializer", + LocOffsetEnd: 13, + LocOffsetStart: 7, + 'Prop_Expression': { + ExpressionType: "const char [3]", + ExpressionValueCategory: "LVALUE", + IASTClass: "CPPASTLiteralExpression", + IsLValue: true, + LiteralValue: "\"𝓏\"", + LocOffsetEnd: 13, + LocOffsetStart: 9, + kind: "string_literal", + }, + 'Prop_InitializerClause': { + ExpressionType: "const char [3]", + ExpressionValueCategory: "LVALUE", + IASTClass: "CPPASTLiteralExpression", + IsLValue: true, + LiteralValue: "\"𝓏\"", + LocOffsetEnd: 13, + LocOffsetStart: 9, + kind: "string_literal", + }, + }, + 'Prop_Name': { + IASTClass: "CPPASTName", + LocOffsetEnd: 6, + LocOffsetStart: 5, + Name: "a", + }, + 'Prop_TypeNode': ~, + }, + ], + }, + ], + 'Prop_PreprocStatements': [], +} \ No newline at end of file diff --git a/fixtures/unicode.cpp.sem.uast b/fixtures/unicode.cpp.sem.uast new file mode 100644 index 0000000..0edcdf7 --- /dev/null +++ b/fixtures/unicode.cpp.sem.uast @@ -0,0 +1,148 @@ +{ '@type': "cpp:CPPASTTranslationUnit", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 14, + line: 1, + col: 15, + }, + }, + 'Prop_BuiltinMacroDefinitions': [], + 'Prop_Declarations': [ + { '@type': "cpp:CPPASTSimpleDeclaration", + '@role': [Declaration, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 14, + line: 1, + col: 15, + }, + }, + 'Prop_DeclSpecifier': { '@type': "cpp:CPPASTSimpleDeclSpecifier", + '@token': "auto", + '@role': [Incomplete, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 4, + line: 1, + col: 5, + }, + }, + IsComplex: false, + IsConst: false, + IsConstExpr: false, + IsExplicit: false, + IsFriend: false, + IsImaginary: false, + IsInline: false, + IsLong: false, + IsLongLong: false, + IsRestrict: false, + IsShort: false, + IsSigned: false, + IsThreadLocal: false, + IsUnsigned: false, + IsVirtual: false, + IsVolatile: false, + StorageClass: "unspecified", + }, + 'Prop_Declarators': [ + { '@type': "cpp:CPPASTDeclarator", + '@role': [Declaration, Name, Variable], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5, + line: 1, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + DeclaresParameterPack: false, + 'Prop_Initializer': { '@type': "cpp:CPPASTEqualsInitializer", + '@role': [Assignment, Declaration, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7, + line: 1, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + 'Prop_Expression': { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 9, + line: 1, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + Format: "", + Value: "𝓏", + }, + 'Prop_InitializerClause': { '@type': "uast:String", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 9, + line: 1, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + Format: "", + Value: "𝓏", + }, + }, + 'Prop_Name': { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5, + line: 1, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 6, + line: 1, + col: 7, + }, + }, + Name: "a", + }, + 'Prop_TypeNode': ~, + }, + ], + }, + ], + 'Prop_PreprocStatements': [], +} \ No newline at end of file diff --git a/fixtures/unicode.cpp.uast b/fixtures/unicode.cpp.uast new file mode 100644 index 0000000..f73f8d5 --- /dev/null +++ b/fixtures/unicode.cpp.uast @@ -0,0 +1,157 @@ +{ '@type': "CPPASTTranslationUnit", + '@role': [File, Module], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 14, + line: 1, + col: 15, + }, + }, + 'Prop_BuiltinMacroDefinitions': [], + 'Prop_Declarations': [ + { '@type': "CPPASTSimpleDeclaration", + '@role': [Declaration, Statement], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 14, + line: 1, + col: 15, + }, + }, + 'Prop_DeclSpecifier': { '@type': "CPPASTSimpleDeclSpecifier", + '@token': "auto", + '@role': [Incomplete, Type], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 0, + line: 1, + col: 1, + }, + end: { '@type': "uast:Position", + offset: 4, + line: 1, + col: 5, + }, + }, + IsComplex: false, + IsConst: false, + IsConstExpr: false, + IsExplicit: false, + IsFriend: false, + IsImaginary: false, + IsInline: false, + IsLong: false, + IsLongLong: false, + IsRestrict: false, + IsShort: false, + IsSigned: false, + IsThreadLocal: false, + IsUnsigned: false, + IsVirtual: false, + IsVolatile: false, + StorageClass: "unspecified", + }, + 'Prop_Declarators': [ + { '@type': "CPPASTDeclarator", + '@role': [Declaration, Name, Variable], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5, + line: 1, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + DeclaresParameterPack: false, + 'Prop_Initializer': { '@type': "CPPASTEqualsInitializer", + '@role': [Assignment, Declaration, Expression, Right], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 7, + line: 1, + col: 8, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + 'Prop_Expression': { '@type': "CPPASTLiteralExpression", + '@token': "\"𝓏\"", + '@role': [Expression, Literal, String], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 9, + line: 1, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + ExpressionType: "const char [3]", + ExpressionValueCategory: "LVALUE", + IsLValue: true, + kind: "string_literal", + }, + 'Prop_InitializerClause': { '@type': "CPPASTLiteralExpression", + '@token': "\"𝓏\"", + '@role': [Expression, Literal, String], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 9, + line: 1, + col: 10, + }, + end: { '@type': "uast:Position", + offset: 13, + line: 1, + col: 14, + }, + }, + ExpressionType: "const char [3]", + ExpressionValueCategory: "LVALUE", + IsLValue: true, + kind: "string_literal", + }, + }, + 'Prop_Name': { '@type': "CPPASTName", + '@token': "a", + '@role': [Identifier], + '@pos': { '@type': "uast:Positions", + start: { '@type': "uast:Position", + offset: 5, + line: 1, + col: 6, + }, + end: { '@type': "uast:Position", + offset: 6, + line: 1, + col: 7, + }, + }, + }, + 'Prop_TypeNode': ~, + }, + ], + }, + ], + 'Prop_PreprocStatements': [], +} \ No newline at end of file