BOOL JSONConfiguration::GetBool(IN const string &name) { return find_bool(_rootValue.get_obj(),name); }
static void txt_format_line(SpaceText *st, TextLine *line, int do_next) { FlattenString fs; char *str, *fmt, orig, cont, find, prev = ' '; int len, i; /* Get continuation from previous line */ if(line->prev && line->prev->format != NULL) { fmt= line->prev->format; cont = fmt[strlen(fmt)+1]; /* Just after the null-terminator */ } else cont = 0; /* Get original continuation from this line */ if(line->format != NULL) { fmt= line->format; orig = fmt[strlen(fmt)+1]; /* Just after the null-terminator */ } else orig = 0xFF; flatten_string(st, &fs, line->line); str = fs.buf; len = strlen(str); if(!text_check_format_len(line, len)) { flatten_string_free(&fs); return; } fmt = line->format; while(*str) { /* Handle escape sequences by skipping both \ and next char */ if(*str == '\\') { *fmt = prev; fmt++; str++; if(*str == '\0') break; *fmt = prev; fmt++; str++; continue; } /* Handle continuations */ else if(cont) { /* Triple strings ("""...""" or '''...''') */ if(cont & TXT_TRISTR) { find = (cont & TXT_DBLQUOTSTR) ? '"' : '\''; if(*str==find && *(str+1)==find && *(str+2)==find) { *fmt = 'l'; fmt++; str++; *fmt = 'l'; fmt++; str++; cont = 0; } /* Handle other strings */ } else { find = (cont & TXT_DBLQUOTSTR) ? '"' : '\''; if(*str == find) cont = 0; } *fmt = 'l'; } /* Not in a string... */ else { /* Deal with comments first */ if(prev == '#' || *str == '#') *fmt = '#'; /* Strings */ else if(*str == '"' || *str == '\'') { find = *str; cont = (*str== '"') ? TXT_DBLQUOTSTR : TXT_SNGQUOTSTR; if(*(str+1) == find && *(str+2) == find) { *fmt = 'l'; fmt++; str++; *fmt = 'l'; fmt++; str++; cont |= TXT_TRISTR; } *fmt = 'l'; } /* Whitespace (all ws. has been converted to spaces) */ else if(*str == ' ') *fmt = '_'; /* Numbers (digits not part of an identifier and periods followed by digits) */ else if((prev != 'q' && text_check_digit(*str)) || (*str == '.' && text_check_digit(*(str+1)))) *fmt = 'n'; /* Booleans */ else if(prev != 'q' && (i=find_bool(str)) != -1) if(i>0) { while(i>1) { *fmt = 'n'; fmt++; str++; i--; } *fmt = 'n'; } else *fmt = 'q'; /* Punctuation */ else if(text_check_delim(*str)) *fmt = '!'; /* Identifiers and other text (no previous ws. or delims. so text continues) */ else if(prev == 'q') *fmt = 'q'; /* Not ws, a digit, punct, or continuing text. Must be new, check for special words */ else { /* Special vars(v) or built-in keywords(b) */ if((i=find_specialvar(str)) != -1) prev = 'v'; else if((i=find_builtinfunc(str)) != -1) prev = 'b'; else if((i=find_decorator(str)) != -1) prev = 'v'; /* could have a new color for this */ if(i>0) { while(i>1) { *fmt = prev; fmt++; str++; i--; } *fmt = prev; } else *fmt = 'q'; } } prev = *fmt; fmt++; str++; } /* Terminate and add continuation char */ *fmt = '\0'; fmt++; *fmt = cont; /* Debugging */ //print_format(st, line); /* If continuation has changed and we're allowed, process the next line */ if(cont!=orig && do_next && line->next) { txt_format_line(st, line->next, do_next); } flatten_string_free(&fs); }