From 012448ebe89270c94c108d765c6a938b1589cefa Mon Sep 17 00:00:00 2001 From: Ben S Date: Mon, 23 Nov 2015 12:56:37 +0000 Subject: [PATCH] Fix bug in attribute value highlighting Any newlines within strings are now properly catered for. Fixes #3. --- Rust.xcodeproj/project.pbxproj | 5 ++--- rust.mm | 6 ++++++ smoke.rs | 6 ++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Rust.xcodeproj/project.pbxproj b/Rust.xcodeproj/project.pbxproj index 07ca88d..c5a32c7 100644 --- a/Rust.xcodeproj/project.pbxproj +++ b/Rust.xcodeproj/project.pbxproj @@ -49,7 +49,6 @@ name = Rust; productInstallPath = "$(HOME)/Library/Bundles"; productName = "Hello World"; - productReference = B57F6C2519FD60C000FDB959 /* Rust.bblm */; productType = "com.apple.product-type.bundle"; }; /* End PBXNativeTarget section */ @@ -100,7 +99,7 @@ OTHER_CFLAGS = ""; PRODUCT_NAME = Rust; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; - SDKROOT = macosx10.10; + SDKROOT = macosx; USER_HEADER_SEARCH_PATHS = "/Volumes/BBEdit\\ SDK/Interfaces/Language\\ Modules/"; WRAPPER_EXTENSION = bblm; }; @@ -117,7 +116,7 @@ OTHER_CFLAGS = ""; PRODUCT_NAME = Rust; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; - SDKROOT = macosx10.10; + SDKROOT = macosx; USER_HEADER_SEARCH_PATHS = "/Volumes/BBEdit\\ SDK/Interfaces/Language\\ Modules/"; WRAPPER_EXTENSION = bblm; }; diff --git a/rust.mm b/rust.mm index 024da9c..864e44e 100644 --- a/rust.mm +++ b/rust.mm @@ -206,6 +206,12 @@ SInt32 skipAttribute(BBLMTextIterator &iter) length++; break; } + else if (ch == '"') + { + // We only want to skip newlines in attributes if they're within a string. + iter--; + length += skipString(iter); + } else if (ch == '\n' || ch == '\r') { break; diff --git a/smoke.rs b/smoke.rs index a58f5e3..812fe64 100644 --- a/smoke.rs +++ b/smoke.rs @@ -113,6 +113,12 @@ #[macro_use] use this_is_not_an_attribute; + #[unfinished_attribute // not a comment + and this should be back to regular code. // back to comments again + + #[unfinished_attribute="but look \ // not a comment + a string!"] // back to comments again + // Macros // ------