fixed indent bug with end of line comment, removed token merging

This commit is contained in:
Allen Webster 2016-08-31 11:10:22 -04:00
parent efd7f19000
commit 6986f3c854
11 changed files with 58 additions and 127 deletions

View File

@ -22,7 +22,7 @@ ul { list-style: none; padding: 0; margin: 0; }
<h2 id='section_introduction'>&sect;1 Introduction</h2>
<div>
<p>
This is the documentation for alpha 4.0.10 The documentation is still under construction so some of the links are linking to sections that have not been written yet. What is here should be correct and I suspect useful even without some of the other sections. </p>
This is the documentation for alpha 4.0.11 The documentation is still under construction so some of the links are linking to sections that have not been written yet. What is here should be correct and I suspect useful even without some of the other sections. </p>
<p>
If you have questions or discover errors please contact <span style='font-family: "Courier New", Courier, monospace; text-align: left;'>editor@4coder.net</span> or to get help from community members you can post on the 4coder forums hosted on handmade.network at <span style='font-family: "Courier New", Courier, monospace; text-align: left;'>4coder.handmade.network</span></p>
</div>
@ -718,8 +718,8 @@ cursor in the same column or x position.</div><div style='margin-top: 3mm; margi
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Return</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero on success.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>The highlight is mutually exclusive to the cursor. When the turn_on parameter
is set to true the highlight will be shown and the cursor will be hidden. After
that either setting the with view_set_cursor or calling view_set_highlight and
the turn_on set to false, will switch back to showing the cursor.</div></div><hr>
that either setting the cursor with view_set_cursor or calling view_set_highlight
and the turn_on set to false, will switch back to showing the cursor.</div></div><hr>
<div id='view_set_buffer_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.35: view_set_buffer</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>bool32 app->view_set_buffer(

View File

@ -1,80 +0,0 @@
/* "4cpp" Open C++ Parser v0.1: Config
no warranty implied; use at your own risk
NOTES ON USE:
This file is used to configure 4cpp options at the begining of 4cpp files.
It is not meant to be used directly.
*/
#ifdef FCPP_NO_CRT
# ifndef FCPP_NO_MALLOC
# define FCPP_NO_MALLOC
# endif
# ifndef FCPP_NO_ASSERT
# define FCPP_NO_ASSERT
# endif
# ifndef FCPP_NO_STRING
# define FCPP_NO_STRING
# endif
#endif
#ifdef FCPP_FORBID_MALLOC
# define FCPP_NO_MALLOC
#endif
#ifndef FCPP_NO_MALLOC
# include <stdlib.h>
#endif
#ifndef FCPP_NO_ASSERT
# include <assert.h>
#endif
#ifndef FCPP_NO_STRING
# include <string.h>
#endif
#ifndef FCPP_NO_MALLOC
# ifndef FCPP_GET_MEMORY
# define FCPP_GET_MEMORY malloc
# endif
# ifndef FCPP_FREE_MEMORY
# define FCPP_FREE_MEMORY free
# endif
#else
# ifndef FCPP_FORBID_MALLOC
# ifndef FCPP_GET_MEMORY
# error Missing definition for FCPP_GET_MEMORY
# endif
# ifndef FCPP_FREE_MEMORY
# error Missing definition for FCPP_FREE_MEMORY
# endif
# endif
#endif
#ifndef FCPP_NO_ASSERT
# ifndef FCPP_ASSERT
# define FCPP_ASSERT assert
# endif
#else
# ifndef FCPP_ASSERT
# define FCPP_ASSERT(x)
# endif
#endif
#ifndef FCPP_NO_STRING
# ifndef FCPP_MEM_COPY
# define FCPP_MEM_COPY memcpy
# endif
# ifndef FCPP_MEM_MOVE
# define FCPP_MEM_MOVE memmove
# endif
#endif
#ifndef FCPP_LINK
# ifdef FCPP_EXTERN
# define FCPP_LINK extern
# else
# define FCPP_LINK static
# endif
#endif

View File

@ -1618,7 +1618,7 @@ FSTRING_LINK int32_t
str_to_int_c(char *str){
int32_t x = 0;
for (; *str; ++str){
if (*str >= '0' || *str <= '9'){
if (*str >= '0' && *str <= '9'){
x *= 10;
x += *str - '0';
}

View File

@ -1,15 +1,16 @@
#define MAJOR 4
#define MINOR 0
#define PATCH 10
#define PATCH 11
#define VN__(a,b,c) #a"."#b"."#c
#define VN_(a,b,c) VN__(a,b,c)
#define VERSION_NUMBER VN_(MAJOR,MINOR,PATCH)
#define VERSION_STRING "alpha " VERSION_NUMBER
#ifdef FRED_SUPER
#if defined(FRED_SUPER)
#define VERSION_TYPE " super!"
#else
#define VERSION_TYPE
#endif
#define VERSION VERSION_STRING VERSION_TYPE

View File

@ -297,6 +297,7 @@ cpp_pp_directive_to_state(Cpp_Token_Type type){
return(result);
}
#if 0
FCPP_LINK Cpp_Token_Merge
cpp_attempt_token_merge(Cpp_Token prev_token, Cpp_Token next_token){
Cpp_Token_Merge result = {(Cpp_Token_Type)0};
@ -312,25 +313,32 @@ cpp_attempt_token_merge(Cpp_Token prev_token, Cpp_Token next_token){
prev_token.size = next_token.start + next_token.size - prev_token.start;
result.new_token = prev_token;
}
return result;
return(result);
}
#endif
FCPP_LINK int32_t
cpp_place_token_nonalloc(Cpp_Token *out_tokens, int32_t token_i, Cpp_Token token){
Cpp_Token_Merge merge = {(Cpp_Token_Type)0};
//Cpp_Token_Merge merge = {(Cpp_Token_Type)0};
Cpp_Token prev_token = {(Cpp_Token_Type)0};
if (token_i > 0){
prev_token = out_tokens[token_i - 1];
#if 0
merge = cpp_attempt_token_merge(prev_token, token);
if (merge.did_merge){
out_tokens[token_i - 1] = merge.new_token;
}
#endif
}
#if 0
if (!merge.did_merge){
out_tokens[token_i++] = token;
}
#else
out_tokens[token_i++] = token;
#endif
return(token_i);
}
@ -1178,28 +1186,6 @@ cpp_relex_nonalloc_main(Cpp_Relex_State *state,
double_break:;
if (!went_too_far){
if (relex_stack->count > 0){
if (state->start_token_i > 0){
Cpp_Token_Merge merge =
cpp_attempt_token_merge(tokens[state->start_token_i - 1],
relex_stack->tokens[0]);
if (merge.did_merge){
--state->start_token_i;
relex_stack->tokens[0] = merge.new_token;
}
}
if (relex_end_i < state->stack->count){
Cpp_Token_Merge merge =
cpp_attempt_token_merge(relex_stack->tokens[relex_stack->count-1],
tokens[relex_end_i]);
if (merge.did_merge){
++relex_end_i;
relex_stack->tokens[relex_stack->count-1] = merge.new_token;
}
}
}
*relex_end = relex_end_i;
}
else{
@ -1209,7 +1195,7 @@ cpp_relex_nonalloc_main(Cpp_Relex_State *state,
return(went_too_far);
}
#if !defined(FCPP_FORBID_MALLOC)
#if defined(FCPP_ALLOW_MALLOC)
#include <stdlib.h>
#include <string.h>

View File

@ -212,10 +212,12 @@ cpp_token_stack_zero(){
return(stack);
}
#if 0
struct Cpp_Token_Merge{
Cpp_Token new_token;
int32_t did_merge;
};
#endif
struct Seek_Result{
int32_t pos;

View File

@ -1674,8 +1674,8 @@ DOC
(
The highlight is mutually exclusive to the cursor. When the turn_on parameter
is set to true the highlight will be shown and the cursor will be hidden. After
that either setting the with view_set_cursor or calling view_set_highlight and
the turn_on set to false, will switch back to showing the cursor.
that either setting the cursor with view_set_cursor or calling view_set_highlight
and the turn_on set to false, will switch back to showing the cursor.
)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;

View File

@ -28,7 +28,6 @@
#include "4ed.h"
#define FCPP_FORBID_MALLOC
#include "4cpp_lexer.h"
#include "4coder_table.cpp"

View File

@ -13,7 +13,7 @@
#include "internal_4coder_string.cpp"
#define FCPP_LEXER_IMPLEMENTATION
#define FCPP_ALLOW_MALLOC
#include "4cpp_lexer.h"
#include <stdlib.h>

View File

@ -69,10 +69,32 @@
; [X] new file is messed up for code files, it never finishes parsing!
; [X] key presses that should be consumed in the GUI are now passed to the file!
; [X] paste snaps the cursor back into view!
; [X] clean whitespace doesn't appear to be cleaning trailing whitespace anymore???
;
; [] indication on failure to save
; [] clean whitespace doesn't appear to be cleaning trailing whitespace anymore???
; [] history is broken, revist the entire system
;
; [] 8.0\Include\um\dsound.h
; [] paths with parens in them
; [] double check end of line comments
; [] paste external text from bug report (in email) (not repod, get more info)
;
;
; BEFORE I SHIP
;
; [] tokens in the custom API
; [] auto indent on the custom side
; [] option to not open *messages* every startup
; [] command for resizing panels
; [] control over how mouse effects panel focus
; [] full screen option
; [] API docs as text file
; [] user file bar string
; [] mouse down/up distinction
; [] hook on exit
; [] exit command
; [] read only files
;
; TODOS
@ -104,15 +126,12 @@
; [X] manipulate scroll target API
; [X] generate documentation for custom API
;
; [] OS font rendering
; [] support full length unicode file names
; [] switch based word complete
;
; [] undo groups
; [] cursor/scroll grouping
; [] file status in custom API
; [] user file bar string
; [] simple multi-line editing
; [] allow for arbitrary wrap positions independent of view width
; [] word level wrapping ~ temporary measure really want to have totally formatted code
; [] additional hooks
@ -120,10 +139,14 @@
; [] file out of sync
; [] double binding warnings
;
; [] multi-line editing
; [] multi-cursor editing
;
; GUI related tech
; [X] consolidate all GUI code properly
; [X] rewrite GUI
; [X] arrow navigation of GUIs
; [] scroll bar position and size options
; [] GUI API
;
; search related tech
@ -192,7 +215,6 @@
; [X] shift backspace
; [X] center view on cursor
; [X] delta time in scroll interpolation
; [] close editor command
; [] panel grow/shrink commands
;
@ -204,7 +226,8 @@
; [] fill screen right away
; [] history breaks when heavily used? (disk swaping?)
;
; [] minimize and reopen problem (still not reproduced here)
; [] a triangle rendered for a few frames? color of the dirty markers (not reproduced by me yet)
; [] minimize and reopen problem (not reproduced by me yet)
;
; FANCY-PANTS IDEAS

View File

@ -1342,7 +1342,7 @@ DOC(If str is a valid string representation of an integer, this call will return
the integer represented by the string. Otherwise this call returns zero.) */{
int32_t x = 0;
for (; *str; ++str){
if (*str >= '0' || *str <= '9'){
if (*str >= '0' && *str <= '9'){
x *= 10;
x += *str - '0';
}