From d35a186932e95b979bb947110a2e7d2cca41fcc9 Mon Sep 17 00:00:00 2001 From: Johan Paulsson Date: Sun, 27 Jan 2013 16:54:57 +0000 Subject: Better parser errors on syntax errors. Will show line number, description and where the error happened. Test function for delimited string if they will break reprising. --- tikzit/English.lproj/PropertyInspector.xib | 995 +++++++++++++---------------- tikzit/TikZiT.xcodeproj/project.pbxproj | 14 + tikzit/src/common/TikzGraphAssembler.h | 2 + tikzit/src/common/TikzGraphAssembler.m | 44 +- tikzit/src/common/tikzlexer.lm | 60 +- tikzit/src/common/tikzparser.ym | 3 + 6 files changed, 535 insertions(+), 583 deletions(-) diff --git a/tikzit/English.lproj/PropertyInspector.xib b/tikzit/English.lproj/PropertyInspector.xib index 4ba24a7..91e30c3 100644 --- a/tikzit/English.lproj/PropertyInspector.xib +++ b/tikzit/English.lproj/PropertyInspector.xib @@ -1,5 +1,5 @@ - + 1070 12C60 @@ -10,8 +10,8 @@ com.apple.InterfaceBuilder.CocoaPlugin 2844 - - YES + + IBCustomFormatter NSArrayController NSBox NSButton @@ -29,17 +29,15 @@ NSTextFieldCell NSView NSWindowTemplate - - - YES + + com.apple.InterfaceBuilder.CocoaPlugin - + PluginDependencyRecalculationVersion - - YES + PropertyInspectorController @@ -62,21 +60,21 @@ 256 - - YES + 274 {193, 256} + SFBInspectorView - + {193, 256} - {{0, 0}, {1600, 1200}} + {{0, 0}, {1920, 1200}} {200, 246} {10000000000000, 10000000000000} YES @@ -84,24 +82,21 @@ 268 - - YES + 268 - - YES + 2304 - - YES + 256 {183, 74} - + YES NO YES @@ -119,8 +114,7 @@ {{224, 0}, {16, 17}} - - YES + 85 40 @@ -205,7 +199,7 @@ YES - + 3 2 @@ -232,7 +226,7 @@ 0 1 - + {{1, 17}, {183, 74}} @@ -245,7 +239,7 @@ -2147483392 {{224, 17}, {15, 102}} - + NO _doScroller: @@ -254,9 +248,9 @@ -2147483392 - {{1, 126}, {181, 15}} + {{1, 75}, {183, 16}} - + NO 1 @@ -266,10 +260,9 @@ 2304 - - YES + - + {{1, 0}, {183, 17}} @@ -277,10 +270,10 @@ 4 - + {{4, 31}, {185, 92}} - + 133682 @@ -325,6 +318,7 @@ 292 {{53, 3}, {26, 26}} + YES -2080374784 @@ -429,7 +423,7 @@ NO - + {193, 152} @@ -438,24 +432,21 @@ 268 - - YES + 268 - - YES + 2304 - - YES + 256 {183, 74} - + YES NO YES @@ -473,8 +464,7 @@ {{224, 0}, {16, 17}} - - YES + 85 40 @@ -530,7 +520,7 @@ YES - + 3 2 @@ -546,7 +536,7 @@ 0 1 - + {{1, 17}, {183, 74}} @@ -559,7 +549,7 @@ -2147483392 {{224, 17}, {15, 102}} - + NO _doScroller: @@ -568,9 +558,9 @@ -2147483392 - {{1, 126}, {181, 15}} + {{1, 75}, {183, 16}} - + NO 1 @@ -580,10 +570,9 @@ 2304 - - YES + - + {{1, 0}, {183, 17}} @@ -591,10 +580,10 @@ 4 - + {{4, 33}, {185, 92}} - + 133682 @@ -610,6 +599,7 @@ 292 {{53, 4}, {26, 26}} + YES -2080374784 @@ -673,7 +663,7 @@ NO - + {193, 130} @@ -682,8 +672,7 @@ 268 - - YES + 268 @@ -716,8 +705,7 @@ YES NO YES - - YES + 10 10 @@ -750,7 +738,7 @@ YES - + 3 2 @@ -803,8 +791,7 @@ YES NO YES - - YES + 10 10 @@ -833,7 +820,7 @@ YES - + 3 2 @@ -1000,19 +987,17 @@ 268 - - YES + 2304 - - YES + 256 {183, 44} - + YES NO YES @@ -1029,8 +1014,7 @@ -2147483392 {{224, 0}, {16, 17}} - - YES + 85 40 @@ -1086,7 +1070,7 @@ YES - + 3 2 @@ -1102,7 +1086,7 @@ 0 1 - + {{1, 17}, {183, 44}} @@ -1115,7 +1099,7 @@ -2147483392 {{224, 17}, {15, 102}} - + NO _doScroller: @@ -1124,9 +1108,9 @@ -2147483392 - {{1, 126}, {181, 15}} + {{1, 45}, {183, 16}} - + NO 1 @@ -1136,10 +1120,9 @@ 2304 - - YES + - + {{1, 0}, {183, 17}} @@ -1147,10 +1130,10 @@ 4 - + {{4, 37}, {185, 62}} - + 133682 @@ -1164,19 +1147,17 @@ 268 - - YES + 2304 - - YES + 256 {183, 74} - + YES NO YES @@ -1194,8 +1175,7 @@ {{224, 0}, {16, 17}} - - YES + 85 40 @@ -1251,7 +1231,7 @@ YES - + 3 2 @@ -1267,7 +1247,7 @@ 0 1 - + {{1, 17}, {183, 74}} @@ -1280,7 +1260,7 @@ -2147483392 {{224, 17}, {15, 102}} - + NO _doScroller: @@ -1289,9 +1269,9 @@ -2147483392 - {{1, 126}, {181, 15}} + {{1, 75}, {183, 16}} - + NO 1 @@ -1301,10 +1281,9 @@ 2304 - - YES + - + {{1, 0}, {183, 17}} @@ -1312,10 +1291,10 @@ 4 - + {{4, 247}, {185, 92}} - + 133682 @@ -1331,6 +1310,7 @@ 292 {{53, 8}, {26, 26}} + YES -2080374784 @@ -1463,19 +1443,18 @@ NO - + {193, 344} NSView - - YES + key value isAtom - + Property YES @@ -1486,12 +1465,11 @@ YES - - YES + key value isAtom - + Property YES @@ -1502,12 +1480,11 @@ YES - - YES + key value isAtom - + Property YES @@ -1518,12 +1495,11 @@ YES - - YES + key value isAtom - + Property YES @@ -1534,10 +1510,9 @@ YES - - YES + label - + Node YES @@ -1548,10 +1523,9 @@ YES - - YES + edgeNode - + Edge YES @@ -1613,10 +1587,10 @@ YES YES - + + - - YES + nodePropertiesView @@ -1876,24 +1850,23 @@ value: selection.label value selection.label - - YES - - YES - NSMultipleValuesPlaceholder - NSValueTransformerName - - - YES - Multiple Values - NilToEmptyStringTransformer - - + + Multiple Values + NilToEmptyStringTransformer + 2 644 + + + formatter + + + + 719 + enabled: canAdd @@ -2035,6 +2008,22 @@ 281 + + + formatter + + + + 733 + + + + formatter + + + + 734 + enabled: canAdd @@ -2212,6 +2201,22 @@ 645 + + + formatter + + + + 728 + + + + formatter + + + + 727 + enabled: canAdd @@ -2373,6 +2378,22 @@ 467 + + + formatter + + + + 730 + + + + formatter + + + + 729 + delegate @@ -2430,6 +2451,14 @@ 656 + + + formatter + + + + 724 + value: arrangedObjects.value @@ -2486,6 +2515,22 @@ 647 + + + formatter + + + + 731 + + + + formatter + + + + 732 + enabled: canAdd @@ -2594,6 +2639,14 @@ 648 + + + formatter + + + + 723 + contentArray: selectedNodes @@ -2728,6 +2781,14 @@ 714 + + + formatter + + + + 726 + content: arrangedObjects @@ -2786,6 +2847,14 @@ 715 + + + formatter + + + + 725 + content @@ -2826,15 +2895,12 @@ 684 - + - - YES + 0 - - YES - + @@ -2859,25 +2925,23 @@ 185 - - YES + - + Node Properties View 189 - - YES + - + @@ -2888,10 +2952,9 @@ 191 - - YES + - + @@ -2902,19 +2965,17 @@ 206 - - YES + - + 207 - - YES + - + @@ -2930,13 +2991,12 @@ 258 - - YES + - + @@ -2952,11 +3012,10 @@ 261 - - YES + - + @@ -2967,19 +3026,17 @@ 263 - - YES + - + 264 - - YES + - + @@ -3001,10 +3058,9 @@ 283 - - YES + - + @@ -3015,53 +3071,48 @@ 301 - - YES + - + Graph Properties View 302 - - YES + - + 303 - - YES + - + 304 - - YES + - + 307 - - YES + - + @@ -3077,11 +3128,10 @@ 318 - - YES + - + @@ -3097,19 +3147,17 @@ 321 - - YES + - + 322 - - YES + - + @@ -3147,8 +3195,7 @@ 361 - - YES + @@ -3166,47 +3213,43 @@ - + Edge Properties View 362 - - YES + - + 363 - - YES + - + 364 - - YES + - + 365 - - YES + - + @@ -3232,11 +3275,10 @@ 370 - - YES + - + @@ -3247,19 +3289,17 @@ 372 - - YES + - + 373 - - YES + - + @@ -3280,13 +3320,12 @@ 408 - - YES + - + @@ -3297,11 +3336,10 @@ 410 - - YES + - + @@ -3317,19 +3355,17 @@ 413 - - YES + - + 414 - - YES + - + @@ -3345,28 +3381,25 @@ 422 - - YES + - + 423 - - YES + - + 424 - - YES + - + @@ -3387,10 +3420,9 @@ 434 - - YES + - + @@ -3401,19 +3433,17 @@ 436 - - YES + - + 437 - - YES + - + @@ -3440,19 +3470,17 @@ 461 - - YES + - + 462 - - YES + - + @@ -3475,19 +3503,17 @@ 657 - - YES + - + 658 - - YES + - + @@ -3503,10 +3529,9 @@ 664 - - YES + - + @@ -3517,10 +3542,9 @@ 666 - - YES + - + @@ -3531,10 +3555,9 @@ 668 - - YES + - + @@ -3545,10 +3568,9 @@ 670 - - YES + - + @@ -3559,10 +3581,9 @@ 672 - - YES + - + @@ -3582,286 +3603,153 @@ Target Anchor Names Array Controller - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 185.IBPluginDependency - 189.IBPluginDependency - 190.IBPluginDependency - 191.IBPluginDependency - 192.IBPluginDependency - 206.IBPluginDependency - 207.IBPluginDependency - 208.IBPluginDependency - 209.IBPluginDependency - 258.IBPluginDependency - 259.IBPluginDependency - 260.IBPluginDependency - 261.IBPluginDependency - 262.IBPluginDependency - 263.IBPluginDependency - 264.IBPluginDependency - 265.IBPluginDependency - 266.IBPluginDependency - 272.IBPluginDependency - 283.IBPluginDependency - 284.IBPluginDependency - 301.IBPluginDependency - 302.IBPluginDependency - 303.IBPluginDependency - 304.IBPluginDependency - 307.IBPluginDependency - 314.IBPluginDependency - 317.IBPluginDependency - 318.IBPluginDependency - 319.IBPluginDependency - 320.IBPluginDependency - 321.IBPluginDependency - 322.IBPluginDependency - 323.IBPluginDependency - 324.IBPluginDependency - 325.IBPluginDependency - 326.IBPluginDependency - 343.IBPluginDependency - 360.IBPluginDependency - 361.IBPluginDependency - 362.IBPluginDependency - 363.IBPluginDependency - 364.IBPluginDependency - 365.IBPluginDependency - 366.IBPluginDependency - 367.IBPluginDependency - 368.IBPluginDependency - 369.IBPluginDependency - 370.IBPluginDependency - 371.IBPluginDependency - 372.IBPluginDependency - 373.IBPluginDependency - 374.IBPluginDependency - 375.IBPluginDependency - 376.IBPluginDependency - 408.IBPluginDependency - 409.IBPluginDependency - 410.IBPluginDependency - 411.IBPluginDependency - 412.IBPluginDependency - 413.IBPluginDependency - 414.IBPluginDependency - 415.IBPluginDependency - 416.IBPluginDependency - 422.IBPluginDependency - 423.IBPluginDependency - 424.IBPluginDependency - 425.IBPluginDependency - 426.IBPluginDependency - 427.IBPluginDependency - 434.IBPluginDependency - 435.IBPluginDependency - 436.IBPluginDependency - 437.IBPluginDependency - 438.IBPluginDependency - 439.IBPluginDependency - 441.IBPluginDependency - 442.IBPluginDependency - 461.IBNSWindowAutoPositionCentersHorizontal - 461.IBNSWindowAutoPositionCentersVertical - 461.IBPluginDependency - 461.IBWindowTemplateEditedContentRect - 461.NSWindowTemplate.visibleAtLaunch - 462.IBPluginDependency - 463.IBPluginDependency - 575.IBPluginDependency - 585.IBPluginDependency - 657.IBPluginDependency - 658.IBPluginDependency - 659.IBPluginDependency - 660.IBPluginDependency - 664.IBPluginDependency - 665.IBPluginDependency - 666.IBPluginDependency - 667.IBPluginDependency - 668.IBPluginDependency - 669.IBPluginDependency - 670.IBPluginDependency - 671.IBPluginDependency - 672.IBPluginDependency - 673.IBPluginDependency - 674.IBPluginDependency - 681.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - com.apple.InterfaceBuilder.CocoaPlugin - {{624, 540}, {193, 256}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - + + 718 + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + com.apple.InterfaceBuilder.CocoaPlugin + {{624, 540}, {193, 256}} + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + TikzFormatter + com.apple.InterfaceBuilder.CocoaPlugin + + - - YES - - - + - 717 + 734 - - YES + FirstResponder - - YES - - YES - applyStyleToSelectedNodes: - clearStyleOfSelectedNodes: - - - YES - id - id - - - - YES - - YES - applyStyleToSelectedNodes: - clearStyleOfSelectedNodes: - - - YES - - applyStyleToSelectedNodes: - id - - - clearStyleOfSelectedNodes: - id - - - + + id + id + + + + applyStyleToSelectedNodes: + id + + + clearStyleOfSelectedNodes: + id + + IBUserSource - + 0 IBCocoaFramework @@ -3871,24 +3759,21 @@ com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - + YES 3 - - YES - - YES - NSAddTemplate - NSRemoveTemplate - NSSwitch - - - YES - {8, 8} - {8, 8} - {15, 15} - - + + {8, 8} + {8, 8} + {15, 15} + + + + + NSFormatter + + + diff --git a/tikzit/TikZiT.xcodeproj/project.pbxproj b/tikzit/TikZiT.xcodeproj/project.pbxproj index b8ea5c6..9f165a0 100644 --- a/tikzit/TikZiT.xcodeproj/project.pbxproj +++ b/tikzit/TikZiT.xcodeproj/project.pbxproj @@ -129,6 +129,7 @@ 7F6E2C8916B0091300BFE20D /* maths.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F6E2C8716B0091300BFE20D /* maths.m */; }; 7F6E2C8A16B0096000BFE20D /* SupportDir.m in Sources */ = {isa = PBXBuildFile; fileRef = 55652DF813E1F2030023F4C6 /* SupportDir.m */; }; 7F6E2C8C16B00ABA00BFE20D /* SFBInspectors.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 55CA98D412EF8FCE008F0368 /* SFBInspectors.framework */; }; + 7FB9BFEE16B57C2E00773146 /* TikzFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FB9BFED16B57C2E00773146 /* TikzFormatter.m */; }; 7FEED45716B1A7C500B056CB /* StyleManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FEED45616B1A7C500B056CB /* StyleManager.m */; }; 8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */; }; 8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165FFE840EACC02AAC07 /* InfoPlist.strings */; }; @@ -339,6 +340,8 @@ 55F9E04411FF54F000F5659E /* NSString+LatexConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+LatexConstants.m"; path = "src/common/NSString+LatexConstants.m"; sourceTree = ""; }; 55FF4E64116A401B000C22B4 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; }; 7F6E2C8716B0091300BFE20D /* maths.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = maths.m; path = src/common/test/maths.m; sourceTree = ""; }; + 7FB9BFEC16B57C2E00773146 /* TikzFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TikzFormatter.h; path = src/osx/TikzFormatter.h; sourceTree = ""; }; + 7FB9BFED16B57C2E00773146 /* TikzFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TikzFormatter.m; path = src/osx/TikzFormatter.m; sourceTree = ""; }; 7FEED45516B1A7C400B056CB /* StyleManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleManager.h; path = src/common/StyleManager.h; sourceTree = ""; }; 7FEED45616B1A7C500B056CB /* StyleManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StyleManager.m; path = src/common/StyleManager.m; sourceTree = ""; }; 8D15AC360486D014006FF6A4 /* TikZiT-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "TikZiT-Info.plist"; sourceTree = ""; }; @@ -618,6 +621,7 @@ 55D9467311659F5E0044178C /* Gui */ = { isa = PBXGroup; children = ( + 7FB9BFE616B54BE300773146 /* Formatter */, 55D9468011659FD50044178C /* GraphicsView */, 5573B90C11DA22E500B5DC5D /* Preamble */, 5573B8BF11D9FD1800B5DC5D /* Preview */, @@ -676,6 +680,15 @@ name = StylePalette; sourceTree = ""; }; + 7FB9BFE616B54BE300773146 /* Formatter */ = { + isa = PBXGroup; + children = ( + 7FB9BFEC16B57C2E00773146 /* TikzFormatter.h */, + 7FB9BFED16B57C2E00773146 /* TikzFormatter.m */, + ); + name = Formatter; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -881,6 +894,7 @@ 553A4C5A144ED3D500AA6FAC /* NilToEmptyStringTransformer.m in Sources */, 55598E351635372E0023450A /* DiamondShape.m in Sources */, 7FEED45716B1A7C500B056CB /* StyleManager.m in Sources */, + 7FB9BFEE16B57C2E00773146 /* TikzFormatter.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/tikzit/src/common/TikzGraphAssembler.h b/tikzit/src/common/TikzGraphAssembler.h index adaf443..a0c8a0d 100644 --- a/tikzit/src/common/TikzGraphAssembler.h +++ b/tikzit/src/common/TikzGraphAssembler.h @@ -41,6 +41,8 @@ - (BOOL)parseTikz:(NSString*)tikz; - (BOOL)parseTikz:(NSString*)tikz forGraph:(Graph*)gr; +- (BOOL)testTikz:(NSString*)tikz; + - (void)prepareNode; - (void)finishNode; diff --git a/tikzit/src/common/TikzGraphAssembler.m b/tikzit/src/common/TikzGraphAssembler.m index 7d8d0e7..050b5fe 100644 --- a/tikzit/src/common/TikzGraphAssembler.m +++ b/tikzit/src/common/TikzGraphAssembler.m @@ -34,8 +34,16 @@ extern int yylex_destroy(void); static NSLock *parseLock = nil; static id currentAssembler = nil; +int yylineno; +int yyleng; +int lineno; +int tokenpos; +char *yystr; +char linebuff[500]; + + void yyerror(const char *str) { - NSLog(@"Parse error: %s", str); + NSLog(@"Parse error on line %i: %s\n%s\n%@\n", lineno, str, linebuff, [[@"" stringByPaddingToLength:(tokenpos-yyleng) withString: @" " startingAtIndex:0] stringByAppendingString:[@"" stringByPaddingToLength:yyleng withString: @"^" startingAtIndex:0]]); if (currentAssembler != nil) { NSError *error = [NSError errorWithDomain:@"net.sourceforge.tikzit" code:TZ_ERR_PARSE @@ -81,6 +89,10 @@ int yywrap() { - (BOOL)parseTikz:(NSString*)tikz forGraph:(Graph*)gr { [parseLock lock]; + + lineno = 1; + tokenpos = 0; + linebuff[0] = 0; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; currentAssembler = self; @@ -93,12 +105,14 @@ int yywrap() { // the node map keeps track of the mapping of names to nodes nodeMap = [[NSMutableDictionary alloc] init]; - - // do the parsing - yy_scan_string([tikz UTF8String]); - yyparse(); - yylex_destroy(); - + + // do the parsing if actual input + if([tikz length] > 0){ + yy_scan_string([tikz UTF8String]); + yyparse(); + yylex_destroy(); + } + [nodeMap release]; nodeMap = nil; @@ -110,6 +124,22 @@ int yywrap() { return (graph != nil); } +- (BOOL)testTikz:(NSString *)tikz{ + BOOL r; + + NSString * testTikz = [NSString stringWithFormat: @"{%@}", tikz]; + + yy_scan_string([testTikz UTF8String]); + yylex(); + + r = !(yyleng < [testTikz length]); + + [testTikz autorelease]; + yylex_destroy(); + + return r; +} + - (void)prepareNode { currentNode = [[Node alloc] init]; } diff --git a/tikzit/src/common/tikzlexer.lm b/tikzit/src/common/tikzlexer.lm index 9af0c8d..8f34ace 100644 --- a/tikzit/src/common/tikzlexer.lm +++ b/tikzit/src/common/tikzlexer.lm @@ -1,4 +1,6 @@ %option nounput +%option yylineno + %{ // // tikzparser.l @@ -30,48 +32,62 @@ #include "tikzparser.h" #endif +extern char linebuff[500]; +extern int lineno; +extern yy_size_t yyleng; +extern int tokenpos; %} %% -\n /* ignore end of line */; -[ \t]+ /* ignore whitespace */; -\\begin return LATEXBEGIN; -\\end return LATEXEND; -\{tikzpicture\} return TIKZPICTURE; -\{pgfonlayer\} return PGFONLAYER; -\( return LEFTPARENTHESIS; -\) return RIGHTPARENTHESIS; -\[ return LEFTBRACKET; -\] return RIGHTBRACKET; -; return SEMICOLON; -, return COMMA; -\. return FULLSTOP; -= return EQUALS; -\\draw return DRAW; -to return TO; -\\node return NODE; -\\path return PATH; -node return ALTNODE; -rectangle return RECTANGLE; -at return AT; +%\n /* ignore end of line */; +\n.* { strcpy(linebuff, yytext+1); + lineno++; + tokenpos = 0; + yyless(1); + } +[ ]+ { tokenpos += yyleng; } /* ignore whitespace */; +[\t]+ { tokenpos += 4*yyleng; } /* ignore whitespace */; +\\begin { tokenpos += yyleng; return LATEXBEGIN; } +\\end { tokenpos += yyleng; return LATEXEND; } +\{tikzpicture\} { tokenpos += yyleng; return TIKZPICTURE; } +\{pgfonlayer\} { tokenpos += yyleng; return PGFONLAYER; } +\( { tokenpos += yyleng; return LEFTPARENTHESIS; } +\) { tokenpos += yyleng; return RIGHTPARENTHESIS; } +\[ { tokenpos += yyleng; return LEFTBRACKET; } +\] { tokenpos += yyleng; return RIGHTBRACKET; } +; { tokenpos += yyleng; return SEMICOLON; } +, { tokenpos += yyleng; return COMMA; } +\. { tokenpos += yyleng; return FULLSTOP; } += { tokenpos += yyleng; return EQUALS; } +\\draw { tokenpos += yyleng; return DRAW; } +to { tokenpos += yyleng; return TO; } +\\node { tokenpos += yyleng; return NODE; } +\\path { tokenpos += yyleng; return PATH; } +node { tokenpos += yyleng; return ALTNODE; } +rectangle { tokenpos += yyleng; return RECTANGLE; } +at { tokenpos += yyleng; return AT; } [0-9]+ { + tokenpos += yyleng; yylval.nsstr=[NSString stringWithUTF8String:yytext]; return NATURALNUMBER; } (\-?[0-9]*\.[0-9]+)|(\-?[0-9]+) { + tokenpos += yyleng; yylval.nsstr=[NSString stringWithUTF8String:yytext]; return REALNUMBER; } \\?[a-zA-Z<>\-\'][a-zA-Z<>\-\'0-9]* { //' + tokenpos += yyleng; yylval.nsstr=[NSString stringWithUTF8String:yytext]; return LWORD; } \"[^\"]*\" /* " */ { + tokenpos += yyleng; yylval.nsstr=[NSString stringWithUTF8String:yytext]; return QUOTEDSTRING; } @@ -93,8 +109,10 @@ at return AT; } NSString *s = [buf copy]; + yyleng += 1 + [buf length]; [s autorelease]; yylval.nsstr = s; + tokenpos += yyleng; return DELIMITEDSTRING; } diff --git a/tikzit/src/common/tikzparser.ym b/tikzit/src/common/tikzparser.ym index 532b6c8..487cfd4 100644 --- a/tikzit/src/common/tikzparser.ym +++ b/tikzit/src/common/tikzparser.ym @@ -29,6 +29,9 @@ #import "TikzGraphAssembler.h" #import "GraphElementProperty.h" +extern char* yystr; +extern int yylineno; +extern int tokenpos; extern int yylex(void); extern void yyerror(const char *str); -- cgit v1.2.3