# Can't see the missing curly bracket

**URL:** https://discourse.processing.org/t/cant-see-the-missing-curly-bracket/7135
**Category:** Coding Questions
**Created:** [January 3, 2019, 3:16pm UTC](https://discourse.processing.org/t/cant-see-the-missing-curly-bracket/7135 "2019-01-03T15:16:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![losferatos](https://avatars.discourse-cdn.com/v4/letter/l/e5b9ba/32.png) [@losferatos](https://discourse.processing.org/u/losferatos)
#### Post date: [January 3, 2019, 3:16pm UTC](https://discourse.processing.org/t/cant-see-the-missing-curly-bracket/7135/1 "2019-01-03T15:16:32Z")

</div>

Hi there!  
I have a very short code that should clean up a dump file, but I get continuously errors because there’s a missing “{” and after 1h of frustrated staring, I need your help =)

```auto
ArrayList<String> rough = new ArrayList<String>();
ArrayList<String> sauber = new ArrayList<String>();
PrintWriter output;
String[] p;
String[] q;

void setup() {
  size(400, 400);
  output = createWriter("cleaned.txt"); 
  String[] dump = loadStrings("savefile.xml");

  for (int i=0; i < dump.length-6; i++) {

    if (dump[i].equals("</computer>")) {
      q = splitTokens(dump[i+1], str('"'));

      if (dump[i+3].equals("firewall")) {
        p = splitTokens(dump[i+6], str('"'));
      } else {
        p = splitTokens(dump[i+5], str('"'));
      }

      sauber.add(q[1]);
      sauber.add(q[3]);
      sauber.add(p[1]);
      sauber.add(p[3]);
      sauber.add(" // ");
      printArray(sauber);
    }
  }
}

```

But processing keeps stating that it "Found a { that’s missing a matching }

---

<div class="post-metadata">

### Author: ![BennyHacker](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bennyhacker/32/2969_2.png) [@BennyHacker](https://discourse.processing.org/u/BennyHacker)
#### Post date: [January 3, 2019, 3:42pm UTC](https://discourse.processing.org/t/cant-see-the-missing-curly-bracket/7135/2 "2019-01-03T15:42:09Z")

</div>

I think it may just be a bug when trying to call _splitTokens_ within setup

try placing the code in draw() and adding a method for it to only draw once (like adding _stop()_ after the code is done)

I would also consider [reporting](https://github.com/processing/processing/wiki/Report-Bugs) this bug

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [January 3, 2019, 4:12pm UTC](https://discourse.processing.org/t/cant-see-the-missing-curly-bracket/7135/3 "2019-01-03T16:12:06Z")

</div>

> [@losferatos](#):
>
> But processing keeps stating that it "Found a { that’s missing a matching }

i also see that as long line 20 is not disabled,  
what even makes less sense as the first two splitTokens might work??  
( here is your xml file not available )

but just a idea, how about using

> **[XML / Reference](https://processing.org/reference/XML.html)**
>
> XML is a representation of an XML object, able to parse XML code. Use loadXML() to load external XML files and create XML objects. Only files encoded as U…

---

<div class="post-metadata">

### Author: ![Architector\_4](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/architector_4/32/813_2.png) [@Architector\_4](https://discourse.processing.org/u/Architector_4)
#### Post date: [January 3, 2019, 4:34pm UTC](https://discourse.processing.org/t/cant-see-the-missing-curly-bracket/7135/4 "2019-01-03T16:34:06Z")

</div>

Hmm. Removing line 28 which is `sauber.add(" // ");` seems to fix it. In particular, the `//` in the string causes the error.

Cutting down on code, I came down to this minimum viable example:

```auto
void setup() {
      splitTokens("hi", str('"'));
// println("//");
}

```

Removing the commented out line fixes the error. That is pretty bizarre.

Anyone care to file a bug report? Can’t do that myself right now.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [January 15, 2019, 10:55pm UTC](https://discourse.processing.org/t/cant-see-the-missing-curly-bracket/7135/5 "2019-01-15T22:55:38Z")

</div>

Was this ever reported?

This also fails

```auto
char c = '"';
void setup() {
  // println("//");
}

```

with

> Found a { that’s missing a matching }`

However changing either the single quoted character or the double-quoted string causes the problem to disappear.

```auto
char c = 'a';
void setup() {
  // println("//");
}

```

```auto
char c = '"';
void setup() {
  // println("a");
}

```
