예제 #1
0
t_parse		*ft_checking_syntax(t_token *tok)
{
	tok = inibitor_handler(tok);
	return_type_quoted(tok);
	tok = join_quoted(tok, QUOTES);
	tok = join_quoted(tok, SINGLE_QUOTES);
	tok = ft_subshell(tok);
	tok = check_dollar(tok);
	tok = ft_tild_expand(tok);
	ft_edit_useless(tok);
	if ((tok = ft_token_removal(tok, QUOTES)) == NULL)
		return (NULL);
	if ((tok = ft_token_removal(tok, SINGLE_QUOTES)) == NULL)
		return (NULL);
	tok = join_tokens(tok);
	if ((tok = ft_token_removal(tok, WHITESPACE)) == NULL)
		return (NULL);
	if (!tok)
		return (NULL);
	if (!(ft_command_isvalid(tok)))
	{
		free_token_list(tok);
		return (NULL);
	}
	return (parse_build_list(tok));
}
예제 #2
0
파일: ps1_checker_2.c 프로젝트: jclanoe/SH
void            ps1_checker_2(s_ps1                      ps1_st,
                              bool                       *escaped,
                              bool                       *checked)
{
  check_n(ps1_st, escaped, checked);

  check_dollar(ps1_st, escaped, checked);

  check_a(ps1_st, escaped, checked);

  check_e(ps1_st, escaped, checked);

  check_r(ps1_st, escaped, checked);
}
예제 #3
0
void tex::after_math ()
{
	ptr	a;
	ptr	b;
	scal	d;
	scal	e;
	bool	l;
	int	m;
	ptr	p;
	scal	q;
	ptr	r;
	scal	s;
	scal	t;
	scal	w;
	scal	z;
	int	g1;
	int	g2;
	bool	danger;

	danger = check_font_params();
	m = mode;
	l = FALSE;
	p = fin_mlist(null);
	if (mode == -m) {
		check_dollar();
		a = hpack(mlist_to_hlist(p, TEXT_STYLE, FALSE), 0, ADDITIONAL);
		unsave();
		decr(save_ptr);
		if (saved(0) == 1)
			l = TRUE;
		danger = check_font_params();
		m = mode;
		p = fin_mlist(null);
	} else {
		a = null;
	}
	if (m < 0) {
		tail_append(new_math(math_surround, BEFORE));
		link(tail) = mlist_to_hlist(p, TEXT_STYLE, mode > 0);
		while (link(tail) != null)
			tail = link(tail);
		tail_append(new_math(math_surround, AFTER));
		space_factor = 1000;
		unsave();
	} else {
		if (a == null)
			check_dollar();
		p = mlist_to_hlist(p, DISPLAY_STYLE, FALSE);
		tex::adjust_tail = tex::adjust_head;
		b = hpack(p, 0, ADDITIONAL);
		p = list_ptr(b);
		t = tex::adjust_tail;
		tex::adjust_tail = null;
		w = box_width(b);
		z = display_width;
		s = display_indent;
		if (a == null || danger) {
			e = q = 0;
		} else {
			e = box_width(a);
			q = e + math_quad(TEXT_SIZE);
		}
		if (w + q > z) {
			if (e != 0
			&& (w - tex::total_shrink[NORMAL] + q <= z
			|| tex::total_shrink[FIL] != 0
			|| tex::total_shrink[FILL] != 0
			|| tex::total_shrink[FILLL] != 0)) {
				free_node(b, BOX_NODE_SIZE);
				b = hpack(p, z - q, EXACTLY);
			} else {
				e = 0;
				if (w > z) {
					free_node(b, BOX_NODE_SIZE);
					b = hpack(p, z, EXACTLY);
				}
			}
			w = box_width(b);
		}
		d = half(z - w);
		if (e > 0 && d < 2 * e) {
			d = half(z - w - e);
			if (p != null && type(p) == GLUE_NODE) {
				d = 0;
			}
		}
		tail_append(new_penalty(pre_display_penalty));
		if (d + s <= pre_display_size || l) {
			g1 = ABOVE_DISPLAY_SKIP_CODE;
			g2 = BELOW_DISPLAY_SKIP_CODE;
		} else {
			g1 = ABOVE_DISPLAY_SHORT_SKIP_CODE;
			g2 = BELOW_DISPLAY_SHORT_SKIP_CODE;
		}
		if (l && e == 0) {
			shift_amount(a) = s;
			append_to_vlist(a);
			tail_append(new_penalty(INF_PENALTY));
		} else {
			tail_append(new_param_glue(g1));
		}
		if (e != 0) {
			r = new_kern(z - w - e - d);
			if (l) {
				link(a) = r;
				link(r) = b;
				b = a;
				d = 0;
			} else {
				link(b) = r;
				link(r) = a;
			}
			b = hpack(b, 0, ADDITIONAL);
		}
		shift_amount(b) = s + d;
		append_to_vlist(b);
		if (a != null && e == 0 && !l) {
			tail_append(new_penalty(INF_PENALTY));
			shift_amount(a) = s + z - box_width(a);
			append_to_vlist(a);
			g2 = 0;
		}
		if (t != tex::adjust_head) {
			link(tail) = link(tex::adjust_head);
			tail = t;
		}
		tail_append(new_penalty(post_display_penalty));
		if (g2 > 0) {
			tail_append(new_param_glue(g2));
		}
		resume_after_display();
	}
}