Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1003922 - testBracketHygiene - uses Java brackets (except <>) and javaTok

JavaX fragment (include)

// not including <> as they are ambiguous (< is also a comparison operator)
static S testBracketHygiene_op    = "([{";
static S testBracketHygiene_close = ")]}";

static bool testBracketHygiene(S s) {
  ret testBracketHygiene(s, testBracketHygiene_op, testBracketHygiene_close, null);
}

static bool testBracketHygiene(S s, Var<S> msg) {
  ret testBracketHygiene(s, testBracketHygiene_op, testBracketHygiene_close, msg);
}

static bool testBracketHygiene(S s, S op, S close, Var<S> msg) {
  Pair<Int, S> p = testBracketHygiene2(s, op, close);
  if (p == null) {
    if (msg != null) msg.set("Hygiene OK!");
    true;
  }
  if (msg != null) msg.set(p.b);
  false;
}

Author comment

Began life as a copy of #1003920

download  show line numbers  debug dex   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1003922
Snippet name: testBracketHygiene - uses Java brackets (except <>) and javaTok
Eternal ID of this version: #1003922/5
Text MD5: 2983c7aadc568ced58c9e4a6f6f0b562
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-06 19:13:28
Source code size: 684 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 310 / 302
Version history: 4 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1003922 & http://1003922.tinybrain.de